Your FFmpeg build compilation from source failed because of libdav1d?

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.

On both occasions, the libdavd dependency failed to build. There was some error about --prefix directory not being a subdirectory.

cd ~/ffmpeg_sources && \
git -C dav1d pull 2> /dev/null || git clone \
    --depth 1 https://code.videolan.org/videolan/dav1d.git && \
mkdir -p dav1d/build && \
cd dav1d/build && \
meson setup -Denable_tools=false -Denable_tests=false \
     --default-library=static .. --prefix "$HOME/ffmpeg_build" \
     --libdir="$HOME/ffmpeg_build/lib" && \
ninja && \
ninja install

Instead of the recommended…

--prefix "$HOME/ffmpeg_build"

… I went with …

--prefix "$HOME/ffmpeg_build/bin"

I would like someone to confirm this bug and my fix, 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.

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
cp VERSION VERSION.bak

# 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

Youtube

Link: | Magic Link:

For older posts, check the archives.