CentOs7安装FFmpeg
CentOs7下安装FFmpeg
1.官网下载linux版本的ffmpeg源码包 ffmpeg-4.1.tar.xz
https://johnvansickle.com/ffmpeg/release-source/
(此步骤也可以使用git clone下载源码包,本质上是一样的 )
2、下载并解压
# cd /usr/local # mkdir ffmpeg # cd ffmpeg # wget https://johnvansickle.com/ffmpeg/release-source/ffmpeg-4.1.tar.xz # tar xvJf ffmpeg-4.1.tar.xz
3、切换到ffmpeg-4.1目录、安装gcc编译器
# cd ffmpeg-4.1 # yum install gcc # yum install yasm
4、编译并安装
# ./configure --enable-shared --prefix=/usr/local/ffmpeg # make && make install
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
如果出现如下错误信息:
If you think configure made a mistake, make sure you are using the latest version from Git. If the latest version fails, report the problem to the ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net. Include the log file "config.log" produced by configure as this will help solve the problem.
则需要先安装yasm
# yum install gcc #安装gcc编译器
# yum install yasm #安装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 #编译安装
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
5、修改文件/etc/ld.so.conf
# vim /etc/ld.so.conf 文件尾部增加:
/usr/local/ffmpeg/lib/
输入ldconfig使修改生效
6、配置环境变量
# vim /etc/profile export PATH=$PATH:/usr/local/ffmpeg/bin # source /etc/profile #使配置生效
7、复制ffmpeg 到/usr/bin/ 并给777权限
# cp /usr/local/ffmpeg/bin/ffmpeg /usr/bin/ # chmod -R 777 /usr/bin/ffmpeg
8、查看ffmpeg -version
# ffmpeg -version