207.1. ffmpeg-9.0.2
Record, convert and stream audio and video
| Version | 9.0.2, release 2 |
| Shelf | media-frameworks — Multimedia frameworks, capture, and media inspection |
| Phase | 42_graphics (Graphics Stack), 37 of 189 in build order |
| Licence | GPL-3.0-or-later |
| Homepage | https://ffmpeg.org/ |
| Build time | 7.8 SBU |
| Installed size | 43.4 MiB in 232 files |
| Recipe | ports/core/media-frameworks/ffmpeg/kpkgbuild |
About
FFmpeg records, converts and streams audio and video: the ffmpeg and ffprobe programs and the libav* libraries (codecs, formats, filters, devices, scaling and resampling) that mpv, GStreamer’s gst-libav, PipeWire, OBS Studio, Blender and most other media programs here are built on. It is built with the full codec set: H.264, HEVC, VP8/VP9 and AV1 encode and decode, JPEG XL, MP3, Opus, Vorbis, FLAC and LC3, with subtitle burn-in, HDR tone mapping, high-quality resampling, time-stretch, OCR, QR codes, the OpenCL filters, DVD and Blu-ray input, and hardware acceleration through VA-API and Vulkan. What a user gets from it is in Media, colour and time.
The binary and libraries are GPL-3.0-or-later. LICENSE.notice, beside the recipe, is the record of that choice and of every component’s licence, and the notice a redistributor should read.
Sources
ffmpeg-9.0.2.tar.xz(11.5 MiB)
sha2568c3850283eb25fa026482078a04051e0be17347b09ef81a0849bec15a96e002e
upstream: https://ffmpeg.org/releases/ffmpeg-9.0.2.tar.xz
archive copy: sources-3/media-frameworks--ffmpeg-9.0.2.tar.xz
Dependencies
Depends on: nasm, alsa-lib, zlib, bzip2, xz, gnutls, libdrm, libxml2, freetype2, fontconfig, harfbuzz, fribidi, libwebp, x264, x265, libvpx, svt-av1, dav1d, opus, libvorbis, libogg, lame, libass, libva, perl, vulkan-headers, glslang, spirv-headers, libplacebo, lcms2, liblc3, rubberband, libjxl, zimg, soxr, ocl-icd, opencl-headers, tesseract, qrencode, librsvg, libbluray, libdvdnav, libdvdread, vidstab.
Required by (50): audacious-plugins, audacity, baresip, blender, blind, calibre, celestia, chromaprint, cmus, ddnet, digikam, dosbox-x, dragon, ffmpegthumbs, firefox-esr, freerdp, glaxnimate, gst-libav, haruna, k3b, kdenlive, kfilemetadata, kpipewire, krita, librewolf, minidlna, mlt, mpd, mpv, mpv-mpris, obs-studio, opencv, openimageio, pencil2d, pipewire, ppsspp, qt6-qtmultimedia, ripgrep-all, schismtracker, sdrangel, shotcut, swayimg, thunderbird, timg, vlc, waypipe, whisper.cpp, wine, wlvncc, yazi.
Optional, off in KDOS
These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.
--disable-libxcb, line 75: libxcb (explained with the switches below)--disable-xlib, line 76: libX11
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/42_graphics/phase.env && kpkg install ffmpeg'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/media-frameworks/ffmpeg.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/media-frameworks/ffmpeg
echo '8c3850283eb25fa026482078a04051e0be17347b09ef81a0849bec15a96e002e ffmpeg-9.0.2.tar.xz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/ffmpeg
SRC=$SRC_ROOT/ffmpeg-9.0.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf ffmpeg-9.0.2.tar.xz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
export CFLAGS="$CFLAGS -frandom-seed=ffmpeg"
./configure \
--prefix=/usr \
--mandir=/usr/share/man \
--disable-static \
--disable-debug \
--disable-stripping \
--enable-shared \
--enable-pic \
--enable-lto=auto \
--enable-pthreads \
--enable-version3 \
--enable-gnutls \
--enable-libdrm \
--enable-libfontconfig \
--enable-libfreetype \
--enable-libfribidi \
--enable-libharfbuzz \
--enable-libwebp \
--enable-libxml2 \
--enable-gpl \
--enable-libx264 \
--enable-libx265 \
--enable-libvpx \
--enable-libsvtav1 \
--enable-libdav1d \
--enable-libopus \
--enable-libvorbis \
--enable-libmp3lame \
--enable-libass \
--enable-libbluray \
--enable-libdvdnav \
--enable-libdvdread \
--enable-vaapi \
--enable-vulkan \
--glslc=glslang \
--enable-v4l2-m2m \
--enable-alsa \
--enable-bzlib \
--enable-zlib \
--enable-lzma \
--enable-iconv \
--enable-libplacebo \
--enable-lcms2 \
--enable-liblc3 \
--enable-librubberband \
--enable-libjxl \
--enable-libzimg \
--enable-libsoxr \
--enable-opencl \
--enable-libtesseract \
--enable-libqrencode \
--enable-librsvg \
--enable-libvidstab \
--enable-manpages \
--disable-htmlpages \
--disable-txtpages \
--disable-sdl2 \
--disable-vdpau \
--disable-sndio \
--disable-ffnvcodec \
--disable-cuda-llvm \
--disable-amf \
--disable-libxcb \
--disable-xlib
grep -q '^#define CONFIG_FFV1_VULKAN_ENCODER 1' config_components.h || {
echo 'ffmpeg: no SPIR-V compiler was usable; the Vulkan filters are missing' >&2
exit 1
}
make
make DESTDIR=$PKG install
The switches, and why each is set:
-frandom-seed=ffmpeg— With LTO, fixes the name GCC gives each object’s.gnu.lto_*sections, which is otherwise random on every build. FFmpeg is one of the hot libraries the tree builds with link-time optimisation, and every one of them carries the seed (see Every port).--enable-lto=auto— Link-time optimisation, through FFmpeg’s own switch.--disable-debug— Compiles without-g; no port ships DWARF.--disable-stripping— Installs the programs and libraries as linked, without runningstripon them: a package carries what the port’s flags compiled, and kpkg strips only the symbol table of the largest objects (see What kpkg does around build.sh).--enable-shared,--enable-pic,--enable-pthreads— Sharedlibav*libraries, built as position-independent code, with POSIX threads.--enable-gpl,--enable-version3— Admits the GPL components (x264, x265, rubberband, vid.stab and the DVD pair require--enable-gpl), and with--enable-version3configure licenses the result as GPL version 3 or later. Leaving out the GPL components is the only way back to LGPL, and it costs H.264 and HEVC encoding.--enable-gnutls— TLS for the network protocols (https,tls,rtmps) through gnutls.--enable-libx264,--enable-libx265,--enable-libvpx,--enable-libsvtav1,--enable-libdav1d,--enable-libopus,--enable-libvorbis,--enable-libmp3lame,--enable-liblc3,--enable-libjxl— The external codecs: H.264 and HEVC encoding, VP8/VP9, AV1 encoding through SVT-AV1 and decoding through dav1d, Opus, Vorbis, MP3 encoding, LC3 and JPEG XL. libaom and libopenjpeg are not enabled: libaom would be a second AV1 encoder beside SVT-AV1, and libopenjpeg a second JPEG 2000 encoder beside FFmpeg’s native one.--enable-libfreetype,--enable-libfontconfig,--enable-libharfbuzz,--enable-libfribidi,--enable-libass— Text:drawtextwith font lookup, shaping and bidirectional layout, and subtitle burn-in through libass.--enable-libwebp,--enable-libxml2,--enable-bzlib,--enable-zlib,--enable-lzma,--enable-iconv— WebP; the XML the DASH and IMF demuxers read; bzip2, zlib and LZMA decompression inside containers and image formats; and character-set conversion of subtitles.--enable-libplacebo,--enable-lcms2,--enable-libzimg— GPU rendering and tone mapping throughlibplacebo, ICC colour management, and thezscalefilter.--enable-librubberband,--enable-libsoxr— Time-stretch and pitch-shift (rubberband), and high-quality resampling.--enable-libtesseract,--enable-libqrencode,--enable-librsvg,--enable-libvidstab— Theocrfilter; theqrencodefilter andqrencodesrcsource; SVG decoding; and the two-passvidstabdetectandvidstabtransformstabiliser.--enable-libbluray,--enable-libdvdnav,--enable-libdvdread— Thebluray:protocol, and thedvdvideodemuxer, soffmpeg -f dvdvideo -i /dev/sr0rips a title with its chapters.--enable-libdrm,--enable-vaapi,--enable-v4l2-m2m— DRM frame sharing andkmsgrab, VA-API hardware decode and encode, and the kernel’s V4L2 memory-to-memory codecs.--enable-vulkan— The Vulkan hardware context, filters, encoders and decoders.--glslc=glslang— The SPIR-V compiler the Vulkan filters, encoders and hwaccels are compiled with, from glslang. Its probe only disables them when it fails, sobuild.shchecksconfig_components.hfor the Vulkan FFV1 encoder after configure and stops when it is missing.--enable-opencl— The*_openclfilters (tonemap,nlmeans,unsharp,overlayand the rest), against ocl-icd’s loader. They run on Mesa’s rusticl, which offers a device only for the driversRUSTICL_ENABLEnames, set in/etc/profile.d/50-opencl.sh;-init_hw_device openclfails with no device where it names none.--enable-alsa— ALSA capture and playback devices.--enable-manpages,--disable-htmlpages,--disable-txtpages— The manual pages only.--disable-sdl2— Builds no SDL output device and, with it, noffplay. sdl2-compat reaches back to FFmpeg through sdl3 and pipewire, so depending on it would be a dependency cycle.--disable-vdpau,--disable-sndio,--disable-ffnvcodec,--disable-cuda-llvm,--disable-amf— VDPAU, sndio, NVIDIA’s NVENC/NVDEC and CUDA, and AMD’s AMF have no port; each is autodetected, and VDPAU’s probe links libX11.--disable-libxcb,--disable-xlib— Builds neither thex11grabcapture device nor the Xlib output device. Both are autodetected, and libxcb (installed in an earlier phase) and libX11 (built in this one) are ports, so each is named off and the result does not follow build order.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/ffmpeg, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf ffmpeg-9.0.2-2.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/ffmpeg, and runs the triggers its paths call for.
Other files in the port directory, read by build.sh: LICENSE.notice.
Contents
Installed programs: ffmpeg, ffprobe.
Installed libraries: libavcodec.so, libavdevice.so, libavfilter.so, libavformat.so, libavutil.so, libswresample.so, libswscale.so.
Installed directories: /usr/include/libavcodec, /usr/include/libavdevice, /usr/include/libavfilter, /usr/include/libavformat, /usr/include/libavutil, /usr/include/libswresample, /usr/include/libswscale, /usr/share/ffmpeg, /usr/share/licenses/ffmpeg.
Short descriptions
ffmpeg |
ffmpeg media converter |
ffprobe |
ffprobe media prober |
libavcodec.pc |
FFmpeg codec library |
libavdevice.pc |
FFmpeg device handling library |
libavfilter.pc |
FFmpeg audio/video filtering library |
libavformat.pc |
FFmpeg container format library |
libavutil.pc |
FFmpeg utility library |
libswresample.pc |
FFmpeg audio resampling library |
libswscale.pc |
FFmpeg image rescaling library |
Notes
Every autodetected library is named on or off, so what ships does not depend on which ports happen to be installed first. FFmpeg’s --enable-libjack is off unless named, and it stays off: pipewire links FFmpeg, so FFmpeg cannot have PipeWire’s JACK, and its jack capture device is not built (see JACK programs on the host).
Everything that links FFmpeg, among them pipewire and gst-libav, takes on its GPL with it.