安装依赖库
sudo apt-get install nasm
sudo apt-get install yasm
sudo apt-get install libx264-dev
sudo apt-get install libx265-dev libnuma-dev
sudo apt-get install libvpx-dev
sudo apt-get install libfdk-aac-dev
sudo apt-get install libmp3lame-dev
sudo apt-get install libopus-dev
sudo apt install libsdl2-dev
下载并编译安装ffmpeg源码
Download FFmpeg
# 解压
tar -xvf ffmpeg-6.0.tar.xz
cd ./ffmpeg-6.0/
# 配置
./configure --enable-shared --prefix=/usr/local/ffmpeg --enable-gpl --enable-libx264 --enable-libx265
# 编译并安装
make
sudo make install
# 建立软链接
sudo ln -s /usr/local/ffmpeg/bin/ffmpeg usr/bin/ffmpeg
sudo ln -s /usr/local/ffmpeg/bin/ffplay usr/bin/ffplay
sudo ln -s /usr/local/ffmpeg/bin/ffprobe usr/bin/probe
配置依赖
sudo vim /etc/ld.so.conf
# 添加一行内容:include /usr/local/ffmpeg/lib/
# 更新环境变量
sudo ldconfig
配置动态库环境变量
vim ~/.bashrc
# 添加一行内容:export LD_LIBRARY_PATH=/usr/local/ffmpeg/lib:$LD_LIBRARY_PATH
# 更新环境变量
source ~/.bashrc
测试是否安装成功
ffmpeg -version