Building FFMPEG

I need to compile FFMPEG with MSDK support. There are no official instructions for openSUSE. I install the libmfx package from zypper and yet I get the error “libmfx not found”. I detail the steps I followed below.

I am doing the test in a container with Distrobox.

distrobox create --image registry.opensuse.org/opensuse/tumbleweed:latest --name opensuse_root --root && distrobox enter --root opensuse_root

First I install the dependencies that I deem appropriate from zypper:

sudo zypper install autoconf automake bzip2 cmake-full freetype2-devel gcc gcc-c++ git libfreetype6 libmfx libmp3lame0 libtool libvorbis make mingw64-zlib1 nasm pkgconf yasm

I compile another dependencies that I can’t get from zypper:

### libx264
mkdir -p ~/ffmpeg_sources ~/bin && cd ~/ffmpeg_sources && \
git clone --branch stable --depth 1 https://code.videolan.org/videolan/x264.git && cd x264 && \
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static --enable-pic && \
make && make install

### libx265
mkdir -p ~/ffmpeg_sources ~/bin && cd ~/ffmpeg_sources && \
git clone --branch stable --depth 2 https://bitbucket.org/multicoreware/x265_git && cd x265_git/build/linux && \
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source && \
make && make install

### libvpx
mkdir -p ~/ffmpeg_sources ~/bin && cd ~/ffmpeg_sources && \
git -C libvpx pull 2> /dev/null || git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && cd libvpx && \
./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm && \
make && make install

### libfdk-aac
mkdir -p ~/ffmpeg_sources ~/bin && cd ~/ffmpeg_sources && \
git -C fdk-aac pull 2> /dev/null || git clone --depth 1 https://github.com/mstorsjo/fdk-aac && cd fdk-aac && autoreconf -fiv && \
./configure --prefix="$HOME/ffmpeg_build" --disable-shared && \
make && make install

I check:

sudo find ~/ffmpeg_build -name "*.pc"

~/ffmpeg_build/lib/pkgconfig/x264.pc
~/ffmpeg_build/lib/pkgconfig/x265.pc
~/ffmpeg_build/lib/pkgconfig/vpx.pc
~/ffmpeg_build/lib/pkgconfig/fdk-aac.pc

Now that, in principle, I have everything that is needed, I proceed with FFMPEG:

mkdir -p ~/ffmpeg_sources ~/bin && cd ~/ffmpeg_sources && \
curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && tar xjvf ffmpeg-snapshot.tar.bz2 && cd ffmpeg && \
export PATH="$PATH:$HOME/bin" && export PKG_CONFIG_PATH="/usr/lib64/pkgconfig:$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 \
  --extra-libs=-lm \
  --bindir="$HOME/bin" \
  --enable-gpl `#libx264 libx265` \
  --enable-libfdk_aac `#libfdk_aac` \
  --enable-libfreetype `#freetype2-devel` \
  --enable-libmfx `#libmfx` \
  --enable-libmp3lame `#libmp3lame` \
  --enable-libvpx `#libvpx` \
  --enable-libx264 `#libx264` \
  --enable-libx265 `#libx265` \
  --enable-nonfree `#libfdk_aac`

At this point I get the error:

ERROR: libmfx not found

I try to locate the library that the configurator doesn’t find and that I installed using zypper:

sudo find / -name "*libmfx*"

/run/host/usr/share/licenses/libmfx1
/run/host/usr/lib64/mfx/libmfx_h264la_hw64.so
/run/host/usr/lib64/mfx/libmfx_hevc_fei_hw64.so
/run/host/usr/lib64/mfx/libmfx_hevcd_hw64.so
/run/host/usr/lib64/mfx/libmfx_hevce_hw64.so
/run/host/usr/lib64/mfx/libmfx_vp8d_hw64.so
/run/host/usr/lib64/mfx/libmfx_vp9d_hw64.so
/run/host/usr/lib64/mfx/libmfx_vp9e_hw64.so
/run/host/usr/lib64/libmfx-tracer.so.1
/run/host/usr/lib64/libmfx-tracer.so.1.35
/run/host/usr/lib64/libmfx.so.1
/run/host/usr/lib64/libmfx.so.1.35
/run/host/usr/lib64/libmfxhw64.so.1
/run/host/usr/lib64/libmfxhw64.so.1.35
/usr/lib64/mfx/libmfx_h264la_hw64.so
/usr/lib64/mfx/libmfx_hevc_fei_hw64.so
/usr/lib64/mfx/libmfx_hevcd_hw64.so
/usr/lib64/mfx/libmfx_hevce_hw64.so
/usr/lib64/mfx/libmfx_vp8d_hw64.so
/usr/lib64/mfx/libmfx_vp9d_hw64.so
/usr/lib64/mfx/libmfx_vp9e_hw64.so
/usr/lib64/libmfx-tracer.so.1
/usr/lib64/libmfx-tracer.so.1.35
/usr/lib64/libmfx.so.1
/usr/lib64/libmfx.so.1.35
/usr/lib64/libmfxhw64.so.1
/usr/lib64/libmfxhw64.so.1.35
/usr/share/doc/packages/libmfx
/usr/share/licenses/libmfx1

Does not locate any file with *.pc extension!
I will look for all files with the *.pc extension

sudo find / -name "*.pc"

~/ffmpeg_sources/x264/x264.pc
~/ffmpeg_sources/x265_git/build/linux/x265.pc
~/ffmpeg_sources/libvpx/vpx.pc
~/ffmpeg_sources/fdk-aac/fdk-aac.pc
~/ffmpeg_build/lib/pkgconfig/x264.pc
~/ffmpeg_build/lib/pkgconfig/x265.pc
~/ffmpeg_build/lib/pkgconfig/vpx.pc
~/ffmpeg_build/lib/pkgconfig/fdk-aac.pc
/run/host/usr/share/pkgconfig/shared-mime-info.pc
/run/host/usr/share/pkgconfig/systemd.pc
/run/host/usr/share/pkgconfig/udev.pc
/run/host/usr/share/pkgconfig/dracut.pc
/run/host/home/user/ffmpeg_sources/x264/x264.pc
/run/host/home/user/ffmpeg_sources/x265_git/build/linux/x265.pc
/run/host/home/user/ffmpeg_sources/libvpx/vpx.pc
/run/host/home/user/ffmpeg_sources/fdk-aac/fdk-aac.pc
/run/host/home/user/ffmpeg_build/lib/pkgconfig/x264.pc
/run/host/home/user/ffmpeg_build/lib/pkgconfig/x265.pc
/run/host/home/user/ffmpeg_build/lib/pkgconfig/vpx.pc
/run/host/home/user/ffmpeg_build/lib/pkgconfig/fdk-aac.pc
/usr/lib64/pkgconfig/libcrypt.pc
/usr/lib64/pkgconfig/libxcrypt.pc
/usr/lib64/pkgconfig/libbrotlicommon.pc
/usr/lib64/pkgconfig/libbrotlidec.pc
/usr/lib64/pkgconfig/libbrotlienc.pc
/usr/lib64/pkgconfig/zlib.pc
/usr/lib64/pkgconfig/bzip2.pc
/usr/lib64/pkgconfig/freetype2.pc
/usr/share/pkgconfig/xkeyboard-config.pc
/usr/share/pkgconfig/shared-mime-info.pc
/usr/share/pkgconfig/systemd.pc
/usr/share/pkgconfig/adwaita-icon-theme.pc

I only get this error (“libmfx not found”) because it’s the first one the compiler detects, but it wouldn’t find libfdk_aac or libmp3lame either, since there are no *.pc files for these packages.

If I try to compile MSDK I get a similar error:

sudo zypper in cmake-full git pkgconf libdrm2 libdrm_intel1 automake autoconf libtool && \
mkdir -p ~/ffmpeg_sources && cd ~/ffmpeg_sources && \
git clone https://github.com/intel/libva.git && \
cd libva && bash ./autogen.sh

configure: error: Package requirements (libdrm >= 2.4.60) were not met:
Package ‘libdrm’, required by ‘virtual:world’, not found
Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.
Alternatively, you may set the environment variables DRM_CFLAGS and DRM_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

I’ve installed the libdrm2-2.4.114-3.1.x86_64 and libdrm_intel1-2.4.114-3.1.x86_64 versions. I’ve searched for more packages with this name in the repositories but I’ve them all installed: zypper se -f libdrm
I can’t find any *.pc files for these packages either.

sudo find / -name "*libdrm*"

/run/host/usr/share/libdrm
/run/host/usr/lib64/libdrm.so.2
/run/host/usr/lib64/libdrm.so.2.4.0
/run/host/usr/lib64/libdrm_radeon.so.1
/run/host/usr/lib64/libdrm_radeon.so.1.0.1
/run/host/usr/lib64/libdrm_nouveau.so.2
/run/host/usr/lib64/libdrm_nouveau.so.2.0.0
/run/host/usr/lib64/libdrm_intel.so.1
/run/host/usr/lib64/libdrm_intel.so.1.0.0
/run/host/usr/lib64/libdrm_amdgpu.so.1
/run/host/usr/lib64/libdrm_amdgpu.so.1.0.0
/usr/lib64/libdrm.so.2
/usr/lib64/libdrm.so.2.4.0
/usr/lib64/libdrm_radeon.so.1
/usr/lib64/libdrm_radeon.so.1.0.1
/usr/lib64/libdrm_nouveau.so.2
/usr/lib64/libdrm_nouveau.so.2.0.0
/usr/lib64/libdrm_amdgpu.so.1
/usr/lib64/libdrm_amdgpu.so.1.0.0
/usr/lib64/libdrm_intel.so.1
/usr/lib64/libdrm_intel.so.1.0.0
/usr/share/libdrm

To build something against another library you need development package for this library. It is exactly the same in almost every other distribution. For libmfx the development package is libmfx-devel.

zypper install 'pkgconfig(libdrm)'

Thanks, it worked. It’s solved!
In other distributions, when looking for a package the normal version and the DEV version appear, in OpenSUSE it doesn’t, and I thought that everything is integrated in the same package.

If anyone gets here with the same problem, the packages I’ve installed have been:

sudo zypper install autoconf automake bzip2 cmake-full freetype2-devel gcc gcc-c++ git libaom-devel libass-devel libbs2b-devel codec2-devel dav1d-devel libdc1394-devel libfdk-aac-devel libjack-devel libmfx-devel libmp3lame-devel openjpeg2-devel libopenmpt-devel libpulse-devel rav1e-devel soxr-devel libvidstab-devel libvorbis-devel libvpx-devel libwebp-devel libtool make mingw64-zlib1 nasm pkgconf yasm

…for the following build options:

mkdir -p ~/ffmpeg_sources ~/bin && cd ~/ffmpeg_sources && \
curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && tar xjvf ffmpeg-snapshot.tar.bz2 && cd ffmpeg && \
export PATH="$PATH:$HOME/bin" && export PKG_CONFIG_PATH="/usr/lib64/pkgconfig:$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 \
  --extra-libs=-lm \
  --bindir="$HOME/bin" \
  --enable-gpl `#libx264 libx265` \
  --enable-libaom `#libaom-devel` \
  --enable-libass `#libass-devel` \
  --enable-libbs2b `#libbs2b-devel` \
  --enable-libcodec2 `#codec2-devel` \
  --enable-libdav1d `#dav1d-devel` \
  --enable-libdc1394 `#libdc1394-devel` \
  --enable-libfdk_aac `#libfdk-aac-devel` \
  --enable-libfreetype `#freetype2-devel` \
  --enable-libjack `#libjack-devel` \
  --enable-libmfx `#libmfx-devel` \
  --enable-libmp3lame `#libmp3lame-devel` \
  --enable-libopenjpeg `#openjpeg2-devel` \
  --enable-libopenmpt `#libopenmpt-devel` \
  --enable-libpulse `#libpulse-devel` \
  --enable-librav1e `#rav1e-devel` \
  --enable-libsoxr `#soxr-devel` \
  --enable-libvidstab `#libvidstab-devel` \
  --enable-libvorbis `#libvorbis-devel` \
  --enable-libvpx `#libvpx-devel` \
  --enable-libwebp `#libwebp-devel` \
  --enable-libx264 `#libx264` \
  --enable-libx265 `#libx265` \
  --enable-nonfree `#libfdk-aac-devel`
make -j4 && make install

Without knowing how you “look” there is no way to comment on it.

But yes, there is no strict rule for naming development packages which is why you should always check required features, not exact names.

I was looking with that command, but in the end I searched in https://software.opensuse.org/

This command looks in packages file list and if you read the zypper manual page, you will find that “the full file list is available for installed packages only. For remote packages only an abstract of their file list is available within the metadata (files containing /etc/, /bin/, or /sbin/)”.

This does not show individual binary packages at all, it shows “source package name”. There could be dozens of individual binary packages built from the same source.