实验环境
centos 7
参考文档
ERROR: x265 not found using pkg-config的解决方法
# 解决ffmpeg执行报错“ffmpeg: error while loading shared libraries: libavdevice.so.58: cannot open shared object file: No such file or directory”的问题
./ffmpeg: error while loading shared libraries: libx264.so.138: cannot open shared object file: No s
#安装准备
需要用到的包
git clone https://code.videolan.org/videolan/x264.git
nasm安装
tar xjvf nasm-2.14.02.tar.bz2
cd nasm-2.14.02
./autogen.sh
./configure --prefix=/usr/local/nasm
make
make install
echo ":/usr/local/nasm/bin" >> /etc/profile
source /etc/profile
nasm -version
安装yasm
tar zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure --prefix=/usr/local/yasm
make
make install
echo ":/usr/local/yasm/bin" >> /etc/profile
source /etc/profile
yasm --version
安装x264
git clone git://git.videolan.org/x264.git
cd x264
./configure --enable-shared --enable-pthread --enable-pic --prefix=/usr/local/x264
make
make install
echo ":/usr/local/x264/bin" >> /etc/profile
source /etc/profile
x264 --version
安装libmp3lame,MP3需要
参考:linux 安装 ffmpeg + libmp3lame
wget https://jaist.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
mv lame-3.99.5.tar.gz /usr/local
cd /usr/local
tar -zxvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure --enable-shared
make
make install
安装ffmpeg
- 安装之前解决下x264不能使用的问题
export PKG_CONFIG_PATH=/usr/local/x264/lib/pkgconfig
2.安装ffmpeg
tar -zxvf ffmpeg-6.0.tar.gz
cd ffmpeg
./configure --enable-gpl --enable-libx264 --enable-libmp3lame --prefix=/usr/local/ffmpeg
make && make install
echo ":/usr/local/ffmpeg/bin" >> /etc/profile
source /etc/profile
3.验证是否成功
ffmpeg -version
应该会报如下错误
解决:
1.查找文件所在位置
2.追加文件到配置文件中
解决 libavdevice.so.60 找不到的问题
解决 libx264.so.164 找不到的问题
4.验证是否安装完成
ffmpeg