1.安装h264拓展包:
tar -xjvf x264-snapshot-20170822-2245-stable.tar.bz2 #解压安装包
cd x264-snapshot-20170822-2245-stable/ #进入解压后的源文件目录
./configure --prefix=/usr/local --enable-shared --disable-asm #进行编译
make
make install
2.安装ffmpeg:
tar -xjvf ffmpeg-3.4.1.tar.bz2 #解压安装包
cd ffmpeg-3.4.1 #进入解压后目录
./configure --enable-gpl --enable-libx264 --disable-yasm #进行编译
make
make install
注:--disable-yasm 参数要看具体情况,可以先不加,看提示进行加参数,也可能是 --disable -x86asm
3.添加动态链接库
vi /etc/ld.so.conf
添加 /usr/local/x264/lib
最终文件内容如下:
include ld.so.conf.d/*.conf
/lib
/usr/lib
/usr/lib64
/usr/local/lib
/usr/local/lib
/usr/local/x264/lib
ldconfig #重新加载配置
ffmpeg #测试是否安装成功
提示以下说明成功:
ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-18)
configuration: --enable-gpl --enable-libx264 --disable-yasm
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
转换命令:
ffmpeg -i a.avi -c:v libx264 -strict -2 a.mp4 #将a.avi转换成a.mp4
[url href=https://cloud.189.cn/t/eAnqimnuIziq]最新的FFMPEG3.4+X264-2017包(访问码:7408)[/url]