CentOS 7.4.1708: ERROR: x265 not found using pkg-config

CentOS 7.4.1708: ERROR: x265 not found using pkg-config

我正在尝试按照 https://trac.ffmpeg.org/wiki/CompilationGuide/Centos and https://developer.nvidia.com/ffmpeg 上的指南在 Nvidia 支持下编译 ffmpeg。我最终得到了以下命令:

PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --enable-pthreads --disable-w32threads --prefix="$HOME/ffmpeg_build" --pkg-config-flags="--static" --extra-cflags="-I$HOME/ffmpeg_build/include -I/usr/local/cuda/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib -L/usr/local/cuda/lib64" --extra-libs='-lpthread -lm' --bindir="$HOME/bin" --enable-gpl --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp

我遇到了奇妙的错误

ERROR: x265 not found using pkg-config

查看 ffbuild/config.log 显示以下错误:

gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -I/home/agilbert/ffmpeg_build/include -I/usr/local/cuda/include -std=c11 -fomit-frame-pointer -pthread -I/home/agilbert/ffmpeg_build/include -I/usr/include/freetype2 -I/home/agilbert/ffmpeg_build/include/opus -I/home/agilbert/ffmpeg_build/include/opus -I/home/agilbert/ffmpeg_build/include -I/home/agilbert/ffmpeg_build/include -I/home/agilbert/ffmpeg_build/include -I/home/agilbert/ffmpeg_build/include -I/home/agilbert/ffmpeg_build/include -I/home/agilbert/ffmpeg_build/include -I/home/agilbert/ffmpeg_build/include -I/home/agilbert/ffmpeg_build/include -L/home/agilbert/ffmpeg_build/lib -c -o /tmp/ffconf.MfrVBc4k/test.o /tmp/ffconf.MfrVBc4k/test.c
In file included from /tmp/ffconf.MfrVBc4k/test.c:1:0:
/home/agilbert/ffmpeg_build/include/x265.h:1753:40: error: expected ';', ',' or ')' before '&' token
 FILE* x265_csvlog_open(const x265_param& param);
                                        ^
/home/agilbert/ffmpeg_build/include/x265.h:1757:40: error: expected ';', ',' or ')' before '&' token
 void x265_csvlog_frame(const x265_param& param, const x265_picture& pic);
                                        ^
/home/agilbert/ffmpeg_build/include/x265.h:1762:64: error: expected ';', ',' or ')' before '&' token
 void x265_csvlog_encode(x265_encoder *encoder, const x265_stats& stats, int argc, char** argv);
                                                                ^
/home/agilbert/ffmpeg_build/include/x265.h:1766:36: error: expected ';', ',' or ')' before '&' token
 void x265_dither_image(x265_picture& pic, int picWidth, int picHeight, int16_t *errorBuf, int bitDepth);
                                    ^
/home/agilbert/ffmpeg_build/include/x265.h:1815:50: error: expected ';', ',' or ')' before '&' token
     FILE*         (*csvlog_open)(const x265_param&);
                                                  ^
/home/agilbert/ffmpeg_build/include/x265.h:1816:51: error: expected ';', ',' or ')' before '&' token
     void          (*csvlog_frame)(const x265_param&, const x265_picture&);
                                                   ^
/home/agilbert/ffmpeg_build/include/x265.h:1817:67: error: expected ';', ',' or ')' before '&' token
     void          (*csvlog_encode)(x265_encoder*, const x265_stats&, int, char**);
                                                                   ^
/home/agilbert/ffmpeg_build/include/x265.h:1818:47: error: expected ';', ',' or ')' before '&' token
     void          (*dither_image)(x265_picture&, int, int, int16_t*, int);
                                               ^
/home/agilbert/ffmpeg_build/include/x265.h:1820:1: warning: no semicolon at end of struct or union [enabled by default]
 } x265_api;
 ^

gcc版本为gcc-4.8.5-16.el7.x86_64

根据下面的问题:是的 - x265 是根据 https://trac.ffmpeg.org/wiki/CompilationGuide/Centos 安装的,是的,pkg-config 正在找到它。编译错误让我觉得我缺少 --pkg-config-flags 选项的标志,但我找不到有效的标志。

有谁知道我应该将什么传递给 pkg-config 以使其启用 x265?

如果这对其他人有帮助,我最后发现当您还指定 --enable-nvenc 时我不需要提供选项 --enable-libx265

我仍然不知道编译错误是什么,但是 --enable-nvenc 您可以使用基于 nVidia 的 GPU 加速在 H.265 中编码。