1、安装各种库:

sudo apt-get install -y autoconf automake build-essential git libass-dev libfreetype6-dev libsdl2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo wget zlib1g-dev yasm cmake mercurial

2、官方下载需要的最新版本的源码 http://ffmpeg.org/download.html#releases,我下载的是ffmpeg-4.4.2.tar.xz

3、解压 tar xvf ffmpeg-4.4.2.tar.xz
4、 进入解压后的目录配置参数

./configure --enable-shared --prefix=/usr/local/

5、编译

make

5、安装

make install

6、修改环境变量

vi ~/.bashrc

export PATH="$PATH:/usr/local/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"