安装依赖
sudo apt-get install yasm
sudo apt-get install libsdl1.2-dev
sudo apt-get install libsdl2-dev
下载安装
tar -zxvf filename.gz
./configure --enable-shared --prefix=/usr/local/ffmpeg
make -j4
sudo make install
添加路径
路径/usr/local/ffmpeg/lib加到sudo vim /etc/ld.so.conf.d/libc.conf
刷新库sudo ldconfig -v
不然会报 error while loading shared libraries: libavcodec.so.58: cannot open shared object file: No such file or directory
版本
修改环境变量
将ffmpeg的绝对路径添加到PATH环境变量中,以让系统能找到ffmpeg的安装路径。
vim ~/.bashrc # 打开系统环境变量配置文件
在文件中添以下内容。
export PATH="/usr/local/ffmpeg/bin:${PATH}"
export LD_LIBRARY_PATH="/usr/local/ffmpeg/lib:{LD_LIBRARY_PATH}"
source ~/.bashrc