编译安装ffmpeg

1、安装yasm

#CentOS
yum install yasm
 
#Debian
apt-get install yasm

无效则

wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make && make install

2、安装ffmpeg

yum install git
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
./configure --enable-shared --prefix=/usr/local/ffmpeg
make && make install

查看ffmpeg版本

/usr/local/ffmpeg/bin/ffmpeg -version

如显示错误为

/usr/local/ffmpeg/bin/ffmpeg: error while loading shared libraries: libavdevice.so.56: cannot open shared object file: No such file or directory

修改/etc/ld.so.conf/ld.so.conf文件

vi /etc/ld.so.conf

内容修改如下,并保存

include ld.so.conf.d/*.conf
/usr/local/ffmpeg/lib/

保存好后,运行↓

ldconfig

添加到环境变量

vi /etc/profile

再最后一行添加

export PATH=/usr/local/ffmpeg/bin/:$PATH

保存退出并重启

查看ffmpeg版本

ffmpeg -version

标签:Centos, debian, ffmpeg, 编译安装

添加新评论