1.根据官方文档 https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
先安装相关依赖库,执行下面的命令进行安装即可
sudo apt-get update -qq && apt-get -y install autoconf automake build-essential cmake git libass-dev libfreetype6-dev libsdl2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev mercurial pkg-config texinfo wget zlib1g-dev
接着安装yasm,执行下面的命令
sudo apt-get install yasm
2. 下载FFmpeg源码 (4.1及以上的版本都可以,文末附所有源码)
http://ffmpeg.org/download.html#releases
3. 解压源码,进入源码目录,执行命令进行安装配置
PATH="/usr/local/bin:$PATH"
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
./configure --prefix="/usr/local" --pkg-config-flags="--static"
--extra-cflags="-I/usr/local/include"
--extra-ldflags="-L/usr/local/lib"
--extra-libs="-lpthread -lm"
--bind