How-to: h264 etc. Support for Firefox (including ffmpeg install)

for future references, “swupd repair” could remove those extra files

Ok, I have been restored a few files with “sudo swupd repair”.
But now I’ve got a new error. This is what I do:

  1. ./configure
  2. make
  3. make check

On the 3rd step, it breaks on fate-api-flac
The api-flac.err file tells me: Can’t find encoder

> ldconfig -p | grep FLAC shows me that I already have it, and it seems that it has been installed with the system: (libc6,x86-64, hwcap: 0x0..) => /usr/lib64/haswell/ (libc6,x86-64)               => /usr/lib64/ (libc6)                      => /usr/lib32/   (libc6,x86-64, hwcap: 0x0..) => /usr/lib64/haswell/   (libc6,x86-64)               => /usr/lib64/   (libc6)                      => /usr/lib32/ (libc6,x86-64)             => /usr/lib64/ (libc6)                    => /usr/lib32/ (libc6,x86-64)               => /usr/lib64/ (libc6)                      => /usr/lib32/

I’ve tried to find out the version:

file /usr/lib64/haswell/
/usr/lib64/haswell/ symbolic link to

How could it be? Here on the I’ve found absolutely different versions (8.3.0 on Clear Linux, and 1.3.3 on

I’ve tried to build flac source from, but it doesn’t help. It still doesn’t see the encoder, and throws an error.
So, how to correctly implement that source and don’t violate the system?

The parameters which I build FFmpeg with:

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

./configure --prefix=/usr/local \
    --extra-cflags="-I/usr/local/include" \
    --extra-ldflags="-L/usr/local/lib" \
    --enable-shared \
    --enable-static \
    --enable-gpl \
    --enable-version3 \
    --enable-nonfree \
    --enable-avcodec \
    --enable-libfdk-aac \
    --enable-libmp3lame \
    --enable-libvorbis \
    --enable-libwavpack \
    --enable-libx264 \
    --enable-libxvid \
    --enable-libwebp \
    --enable-libopus \
    --enable-libv4l2 \
    --enable-libvpx \
    --enable-libmfx \
    --enable-libxcb \
    --enable-libxcb-shm \
    --enable-libxcb-xfixes \
    --enable-libxcb-shape \
    --enable-librsvg \
    --enable-libxml2 \
    --enable-openssl \
    --enable-openal \
    --enable-opengl \
    --enable-libopencore-amrnb \
    --enable-libopencore-amrwb \

have you added /usr/local to ldconfig’s search path?

You mean?
sudo echo "/usr/local/lib" > /etc/
Yes, I have it.

Hey, look I have found an api.mak file:

FATE_API_LIBAVCODEC-$(call ENCDEC, FLAC, FLAC) += fate-api-flac
fate-api-flac: $(APITESTSDIR)/api-flac-test$(EXESUF)
fate-api-flac: CMD = run $(APITESTSDIR)/api-flac-test$(EXESUF)
fate-api-flac: CMP = null

I have the same contents in my file “ffmpeg-4.3/tests/fate/api.mak”.
But I don’t understand what is going on here.

I can reproduce this error

I have found a solution here. It seems that I haven’t the samples for testing.
This one helps me

SAMPLES=fate-suite make fate-rsync
SAMPLES=fate-suite make fate

Now it breaks on “vsynth1-mpng” test

TEST    vsynth1-mpng
--- ./tests/ref/vsynth/vsynth1-mpng	2020-04-28 00:48:16.000000000 +0300
+++ tests/data/fate/vsynth1-mpng	2020-09-13 09:51:07.175165046 +0300
@@ -1,4 +1,4 @@
-6a27410a07ed1c5556e15b7a7c6a586d *tests/data/fate/vsynth1-mpng.avi
-12158280 tests/data/fate/vsynth1-mpng.avi
+42df813b2a8ef033e3600836067b47ff *tests/data/fate/vsynth1-mpng.avi
+12169844 tests/data/fate/vsynth1-mpng.avi
 93695a27c24a61105076ca7b1f010bbd *tests/data/fate/vsynth1-mpng.out.rawvideo
 stddev:    3.42 PSNR: 37.44 MAXDIFF:   48 bytes:  7603200/  7603200
Test vsynth1-mpng failed. Look at tests/data/fate/vsynth1-mpng.err for details.
make: *** [tests/Makefile:256: fate-vsynth1-mpng] Error 1

Ok, here I am and this is what I’ve got at this moment.

Several days wandering around the Internet trying to dive into a build process on Unix systems I came to the conclusion that the build process is a complicated work for those who absolutely new in that direction because it requires the necessary skills and experience. But I have luck, I’m still alive, and I have a working build of FFmpeg with some codecs that I have built.
So there are a couple of things that you have to know about the build process and the environment of the OS.


First of all, you have to be sure that you already have installed libraries on your system, if you want to use non-free libraries (like: mp3, xvid, x264, x265). You have to download them and install them manually before the FFmpeg compilation. To use non-free libraries you need to pass it to the compiler and use the flag --enable-nonfree, like this:

  --enable-nonfree \
  --enable-shared \
  --enable-libmp3lame \
  --enable-libvorbis \
  --enable-libwavpack \
  --enable-libx264 \

To check if the package exists type:

pkg-config --exists --print-errors package_name
pkg-config --exists --print-errors mp3lame
pkg-config --exists --print-errors vorbis
pkg-config --exists --print-errors x264
pkg-config --exists --print-errors xvid

Also, before the compilation, you should care about the location where the non-free libraries are located and pass some environment variables and/or arguments to the build system.

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export LD_LIBRARY_PATH=/usr/local/lib

This tells the compiler where the libraries located is.

You might be surprised by seeing an error when trying to run the program after the build, and the message of the error can look like this:

ffmpeg: symbol lookup error: ffmpeg: undefined symbol: avio_protocol_get_class, version LIBAVFORMAT_58

In fact, the reasons for this behavior can be different:

  • There is no specific file or symbolic link to that file in your or system directory
  • The file is present, but it has a different version
  • The file is located in a different directory

I collect the build in /usr/local, and as a result, I expect for several files which one of them is (or any other file, in your case). But I already have that file in my system that is located in /usr/lib64, which would be chosen first by priority as from the trusted directory in Linux. This is one of the parts of security and the essence of how the packages and repositories work in Linux. In addition, the system developer is partially responsible for this part of the implementation.
There are many solutions on how to organize the functionality of the compiled package using different versions and patches, the implementation of which falls on the developers’ shoulders and is the philosophy of the stability of the distribution. But I hardcoded it using the -rpath key:

./configure \
  --extra-cflags="-I/usr/local/include" \
  --extra-ldflags="-L/usr/local/lib -Wl,-rpath /usr/local/lib" \

This tells the compiler to add the /usr/local path to the ELF-file header, and after building, when you try to run the compiled file, the dependent libraries will be searched in this directory first and then in the system directories /usr/lib or /usr/lib64.
To check the header of an ELF file you can type this:

readelf -d /usr/local/bin/ffmpeg | grep runpath

As a result, you might see something like this:

0x000000000000001d (RUNPATH) Library runpath: [/usr/local/lib:/usr/lib64]

There is another way to change this path without rebuilding the entire package, this solution has drawbacks, but it also needs to be considered:

sudo chrpath --replace /usr/local /usr/local/bin/ffmpeg

It should change the runtime path in the header of the existing file.
Trying to check the libraries which FFmpeg using:

ldd /usr/local/bin/ffmpeg | grep /usr/local
ldd /usr/local/bin/ffmpeg | grep /usr/lib64


# Shared libraries
/usr/local/lib/ (0x00007ff5bfa70000)
/usr/local/lib/ (0x00007ff5bf7fb000)
/usr/local/lib/ (0x00007ff5bbcd4000)
/usr/local/lib/ (0x00007ff5bbbd4000)
/usr/local/lib/ (0x00007ff5bb7d4000)
/usr/local/lib/ (0x00007ff5bb6a4000)

# System libraries
/usr/lib64/haswell/ (0x00007f466a854000)
/usr/lib64/haswell/ (0x00007f4668681000)
/usr/lib64/ (0x00007f466856a000)


If you want to run tests, you have to download all samples for it. Otherwise, you’ll receive an error on one of the tests when you try to run it.

SAMPLES=fate-suite make fate-rsync
SAMPLES=fate-suite make fate

That’s all for now, and be careful in using rpath.