Centos安装ffmpeg视频处理工具(带安装h264编码格式插件)

1、安装yasm编译器
    官方下载地址:http://yasm.tortall.net/Download.html
    依次执行以下命令:

tar -xvzf yasm-1.3.0.tar.gz
cd yasm-1.3.0/
./configure
make && make install
yasm --version

2、安装H264编码器

官方下载地址:http://www.videolan.org/developers/x264.htm
依次执行以下命令:

tar -xvf x264-master.tar.bz2
cd x264-master
./configure --prefix=/usr/local/ffmpeg/x264static --enable-shared --enable-static --disable-asm
make && make install

3、安装ffmpeg
官方下载地址:http://ffmpeg.org/download.html
依次执行以下命令:

tar jxvf ffmpeg-4.2.tar.bz2  #解压bz2需要先安装: yum -y install bzip2

cd ffmpeg-4.2/

./configure --prefix=/usr/local/ffmpeg/ffmpeg --enable-shared --enable-yasm --enable-libx264 --enable-gpl --enable-pthreads --extra-cflags=-I/usr/local/ffmpeg/x264static/include --extra-ldflags=-L/usr/local/ffmpeg/x264static/lib

make && make install   #编译和安装;耗时比较久

异常解决方案:error while loading shared libraries: libavdevice.so.58: cannot open shared
vim /etc/ld.so.conf.d/ffmpeg.conf    
#写入内容“/usr/local/ffmpeg/ffmpeg/lib”后保存退出

异常解决方案:error while loading shared libraries: libx264.so.159: cannot open shared object file: No such file or directory
vi /etc/ld.so.conf
#在最后面写入内容“/usr/local/ffmpeg/x264static/lib”后保存退出

ldconfig   #更新环境变量

./ffmpeg -version           查看安装版本/是否安装成功【可选】
./ffmpeg -encoders |grep 264 检查是否安装H264成功

操作一下试试:/usr/local/ffmpeg/ffmpeg/bin/ffmpeg -i  test3gp.3gp -vcodec h264 -ac 1 -ar 11025 -y -hide_banner  test3gp1.mp4

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章