我正在尝试按照 https://trac.ffmpeg.org/wiki/CompilationGuide/Centos 和 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
我遇到了一个奇妙的错误
错误:使用 pkg 配置找不到 x265
查看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 optnion 的标志,但我找不到一个有效的标志。
有谁知道我应该传递给 pkg-config 以使其启用 x265?
如果这对其他人有帮助,我最终发现当您也指定--enable-nvenc
时,我不需要提供选项--enable-libx265
.
我仍然不知道编译错误是什么,但是有了--enable-nvenc
您可以使用基于 nVidia的 GPU 加速在 H.265 中进行编码。