Your FFmpeg build compilation from source failed because of libvmaf?

The FFmpeg wiki has a mistake. I do not want to modify it unless someone else confirms my fix is right.

Some months ago, Apress asked me to test the book with the latest FFmpeg version. The Reimann LTS version 5.1.1 has already been out in July. I had done the initial re-write of the book with some no-name GIT version that John Sickle had built. (John Sickle's static builds helped me complete the book in an old Ubuntu 10.10 installation on my laptop in 2020 but now I have the latest Linux Mint OS. Sickle's build also does not have FFplay and some obscure FFmpeg encoders, filters and decoders.)

Last week, I installed the same OS on my desktop computer and tried to use the FFmpeg executables that I had built on the laptop. It did not work. Some of the dependencies have had their version numbers changed and I had to rebuild from source on that computer too. It was annoying but I did it anyway.

Everything went fine until these steps from the compilation wiki.

cd ~/ffmpeg_sources && \
wget && \
tar xvf v2.1.1.tar.gz && \
mkdir -p vmaf-2.1.1/libvmaf/build &&\
cd vmaf-2.1.1/libvmaf/build && \
meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=static .. --prefix "$HOME/ffmpeg_build" --bindir="$HOME/bin" --libdir="$HOME/ffmpeg_build/lib" && \
ninja && \
ninja install

On both occasions, the libvmaf dependency failed to build. There was an error about the --bindir directory not being a subdirectory of the --prefix. ERROR: The value of the 'bindir' option is '/home/ya-username/bin' which must be a subdir of the prefix '/home/ya-username/ffmpeg_build'.
Note that if you pass a relative path, it is assumed to be a subdir of prefix.

Instead of the recommended …


… I went with …


… and finished the build. I also manually copied the built vmaf library to the ${HOME}/bin directory.

I would like someone to confirm this bug and update the wiki.

Another compilation tip

The terminator terminal supports multiple split windows. I split it into three windows. One big horizontally split window on the top and two vertically split windows below it. In the first one, I did the compilation. In the second, I used apt search ____ to find development libraries required for the -enable- options. In the third window, I used sudo apt install _____ commands to install the found libraries.

My .configure statement after this was.

PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure   --prefix="$HOME/ffmpeg_build"   --pkg-config-flags="--static"   --extra-cflags="-I$HOME/ffmpeg_build/include"   --extra-ldflags="-L$HOME/ffmpeg_build/lib"   --extra-libs="-lpthread -lm"   --ld="g++"   --bindir="$HOME/bin"   --enable-gpl --enable-static  --enable-gnutls   --enable-libaom   --enable-libass   --enable-libfdk-aac   --enable-libfreetype   --enable-libmp3lame   --enable-libopus   --enable-libsvtav1   --enable-libdav1d   --enable-libvorbis  --enable-libvpx --enable-libwebp --enable-libjxl --enable-libopenjpeg --enable-libpulse --enable-libx264   --enable-libx265   --enable-chromaprint --enable-frei0r   --enable-libbluray --enable-libbs2b --enable-libcdio --enable-librubberband --enable-libspeex --enable-libtheora --enable-libfontconfig   --enable-libfribidi --enable-libxml2 --enable-libxvid --enable-libsmbclient --enable-version3   --enable-libv4l2 --enable-libvidstab --enable-libcaca --enable-opencl --enable-libopenmpt --enable-libmodplug --enable-libgme --enable-libopencore-amrwb --enable-opengl --enable-libsnappy --enable-libmysofa --enable-libshine --enable-libopencore-amrnb --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libflite --enable-libsoxr --enable-ladspa --enable-nonfree && PATH="$HOME/bin:$PATH" make

Yet another tip that I added to the book

If you had installed the pre-built ffmpeg executable and checked the -version option, ffmpeg displays the version like any other command-line program. If you build from source, then ffmpeg will display the label of the source code snapshot on the FFmpeg git repository.

FFmpeg version is not meaningful

I studied the build script and made a few changes to one of the files extracted from the tarball (the downloaded compressed source code).

# Backup the file containing the git label

# Suffix the current date and release version number to the label
echo  -e "$(cat VERSION.bak) [$(date +%Y-%m-%d)] [$(cat RELEASE)] " > VERSION

Then, I ran the make and make install commands to build the binaries. Now, the version number is more meaningful. If I have to deal with multiple ffmpeg binaries sometime in future, this information will be useful.

FFmpeg version is meaningful

This of course assumes that you will build the binaries on the same day you downloaded the source.

Comic Relief


Link: | Magic Link:

For older posts, check the archives.