centos7/8手动编译安装ffmpeg

下载地址

https://www.ffmpeg.org/download.html


#安装gcc编译器和yasm编译器
yum install gcc  yasm -y
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg

cd ffmpeg

./configure --enable-shared --prefix=/usr/local/ffmpeg
make && make install

要等很久才会编译完成

编译安装完成之后添加环境变量
sudo vi ~/.bashrc
写入: export PATH=$PATH:/usr/local/ffmpeg/bin
source ~/.bashrc

如果执行ffmpeg -version 报错:

ffmpeg: error while loading shared libraries: libavdevice.so.58: cannot open shared object file: No such file or directory

 

#编辑ld.so.conf文件,并且在最下面插入两行路径

vi /etc/ld.so.conf

/usr/local/ffmpeg/lib

/usr/local/x264/lib

:wq保存退出然后

 ldconfig

 

posted @ 2021-04-13 14:37  linux-123  阅读(74)  评论(0编辑  收藏  举报