Skip to content

Instantly share code, notes, and snippets.

@shanecp
Last active September 9, 2020 03:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shanecp/38174327c3dc5657ee428d97476f060c to your computer and use it in GitHub Desktop.
Save shanecp/38174327c3dc5657ee428d97476f060c to your computer and use it in GitHub Desktop.
How to Compile FFMpeg to a Specific Version

How to Compile FFMpeg to a Specific Version

You can find FFMpeg compilation instructions from https://trac.ffmpeg.org/wiki/CompilationGuide

If you can't find a pre-built version of FFMpeg, you'll have to compile it from the source. By using the above link, you'll be getting the latest snapshot and it may not be the version you want. If you need to compile a specific version, follow the instructions below.

Pick the correct version you need from https://git.ffmpeg.org/ffmpeg

On the guide, follow all instructions upto 'FFMpeg' section, then instead of the snapshot build, switch to the version needed. (Using v4.3 on the example below)

cd ~/ffmpeg_sources
git clone https://git.ffmpeg.org/ffmpeg.git
cd ffmpeg
git checkout origin/release/4.3
git switch -c release/4.3
git branch --set-upstream-to=origin/release/4.3
git pull --rebase
git describe HEAD

// (optional) change TMPDIR if required
export TMPDIR=~/tmpdir

PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --pkg-config-flags="--static" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --extra-libs=-lpthread --extra-libs=-lm --enable-gpl --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree

make

make install

hash -d ffmpeg

ffmpeg -version

Edit the version number

If you follow the instructions above, you'll get an automated version number, such as n4.3.1-14-ga15a3318e1. If you need to get a semvar version number, such as 4.3.1 then do the following.

Go to the ffmpeg source folder and run

ffbuild/version.sh ./ VERSION

Then open the VERSION file generated, and edit the version number as required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment