linux下安装配置ffmpeg,添加x264、x265支持

ffmpeg编译命令:

./configure --enable-gpl --enable-debug=3 --disable-optimizations --disable-stripping

make & make install

要编译出可调试的ffmpeg必须添加--enable-debug=3

添加x264和x265支持,首先去官网下载x264和x265,分别安装。

重新编译ffmpeg:

./configure --enable-gpl --enable-debug=3 --disable-optimizations --disable-stripping --enable-libx264 --enable-libx265

make  &  make install

可能出现的问题:

1.添加--enable-libx265后,编译提示ERROR: x265 not found in pkg-config

于是重新安装x265,发现x265.pc文件会自动拷贝到/usr/local/lib/pkgconfig目录下;

这时configure还是提示错误;怀疑是PKG_CONFIG_PATH环境变量未定义所致;

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig;

继续configue,成功!

执行make,makeinstall;

2.添加--enable-libx264后,可能会提示错误:

./ffmpeg: error while loading shared libraries: libx264.so.157: cannot open shared object file: No such file or directory

根据网上的方法在/etc/ld.so.conf中添加一行/usr/local/lib,并执行ldconfig使生效。结果还是不行

最后发现执行以下两条命令即可:

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH 
export CFLAGS=/usr/local/include:$CFLAGS 

执行之后不用重新生成

ffmpeg可以编译进许多模块,可以参考下面链接根据自己的需要添加:

https://trac.ffmpeg.org/wiki/CompilationGuide/Centos

猜你喜欢

转载自blog.csdn.net/A199222/article/details/85103420