centos 7下 带264编码的ffmpeg安装

1, 到http://www.videolan.org/developers/x264.html下载264编码库last_x264.tar.bz2
tar -xjf last_x264.tar.bz2 
cd x264-snapshot-20180520-2245/
./configure --prefix=/usr/local/x264 --enable-shared --enable-static --disable-asm
make
make install


2, 到http://ffmpeg.org/download.html下载 ffmpeg 最新版本ffmpeg-4.0.tar.bz2


tar xjf ffmpeg-4.0.tar.bz2
cd ffmpeg-4.0/
./configure --prefix=/usr/local/ffmpeg --enable-shared --enable-yasm --enable-libx264 --enable-gpl --enable-pthreads --extra-cflags=-I/usr/local/x264/include --extra-ldflags=-L/usr/local/x264/lib


//-j7 7个核编译, 加快编译速度
make -j7
make install


3, 测试


ffmpeg -v


如果无异常则安装成功;
异常
错误信息:
ffmpeg: error while loading shared libraries: libavdevice.so.56: cannot open shared object file: No such file or directory
先 find / -name libavdevice.so.56 得到该文件的目录地址,我找到的是在ffmpeg安装目录的lib目录下;
/usr/local/ffmpeg/lib/


vim /etc/ld.so.conf.d/ffmpeg.conf
添加 /usr/local/ffmpeg/lib/ 到/etc/ld.so.conf.d/ffmpeg.conf里


错误信息:
找不到libx264.so.155
find / -name libx264.so.155


vim /etc/ld.so.conf.d/x264.conf

添加 /usr/local/x264/lib/


4, 查看是否有264编码器

ffmpeg -encoders |grep 264



5,注意: 如果在某参机子上编译的ffmpeg库, 放到另一台机子用时. 最好--disable-autodetect, 不然ffmpeg会自动检测原机子上的安装情况, 有可能原机子上装了很多软件. 导致此库移到目标机子上用时, 目标机因为少了很多库而非常麻烦. 比如报下面错:


 用了--disable-autodetect就不用编译不需要的项。不然要自己添加 --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --disable-libxcb-shape --disable-d3d11va --disable-libdrm --disable-dxva2 --disable-vaapi 
  

猜你喜欢

转载自blog.csdn.net/weixin_40592935/article/details/80394744
今日推荐