322.5. handbrake-1.11.2
HandBrake video transcoder: the GTK 4 application and HandBrakeCLI
| Version | 1.11.2, release 1 |
| Shelf | video-tools — Video editing, transcoding, muxing, recording, streaming and webcam apps |
| Phase | 44_apps (Applications), 413 of 422 in build order |
| Licence | GPL-2.0-only |
| Homepage | https://handbrake.fr/ |
| Build time | 17.6 SBU |
| Installed size | 110.0 MiB in 10 files |
| Recipe | ports/core/video-tools/handbrake/kpkgbuild |
About
HandBrake converts video files and unencrypted DVDs and Blu-rays to MP4, MKV and WebM, with presets for devices. The port installs both programs: ghb, the GTK 4 application, and HandBrakeCLI. Both are built on libhb, HandBrake’s library, which this build links statically with the copies of FFmpeg, x265 (8, 10 and 12 bit), SVT-AV1, dav1d, zimg, libdvdread, libdvdnav and libbluray that HandBrake pins.
Sources
handbrake-1.11.2.tar.bz2(11.2 MiB)
sha25612b046350f2422dc28783ff94229aff4ba5fe5e683431e057355d36163b2593a
upstream: https://github.com/HandBrake/HandBrake/releases/download/1.11.2/HandBrake-1.11.2-source.tar.bz2
archive copy: sources-4/video-tools--handbrake-1.11.2.tar.bz2ffmpeg-8.0.2.tar.bz2(13.1 MiB)
sha2562a8b8840c0bc78f5ed1576f98eba7df00c05f87fd6d07fad16efcd9333016edf
upstream: https://github.com/HandBrake/HandBrake-contribs/releases/download/contribs2/ffmpeg-8.0.2.tar.bz2
archive copy: sources-4/video-tools--ffmpeg-8.0.2.tar.bz2x265-snapshot-20260216-13309.tar.gz(1.7 MiB)
sha256a0882bb90826da62a96676c1a7cb7a7beb7f1db901f2775299cbeed03c3eb2a2
upstream: https://github.com/HandBrake/HandBrake-contribs/releases/download/contribs2/x265-snapshot-20260216-13309.tar.gz
archive copy: sources-4/video-tools--x265-snapshot-20260216-13309.tar.gzSVT-AV1-v4.1.0.tar.gz(10.4 MiB)
sha2566c4c0c44ff0ba3d136d6f57f3a707f9de8e9c866f50f809c1d22a43f0d8c9583
upstream: https://github.com/HandBrake/HandBrake-contribs/releases/download/contribs2/SVT-AV1-v4.1.0.tar.gz
archive copy: sources-4/video-tools--SVT-AV1-v4.1.0.tar.gzdav1d-1.5.3.tar.bz2(1.2 MiB)
sha256e099f53253f6c247580c554d53a13f1040638f2066edc3c740e4c2f15174ce22
upstream: https://github.com/HandBrake/HandBrake-contribs/releases/download/contribs2/dav1d-1.5.3.tar.bz2
archive copy: sources-4/video-tools--dav1d-1.5.3.tar.bz2zimg-snapshot-20250624.tar.gz(3.1 MiB)
sha25619a96cdc266466be58be86a9271bedb1f080bf4cc14f5ed58ac39dc5b970fd17
upstream: https://github.com/HandBrake/HandBrake-contribs/releases/download/contribs2/zimg-snapshot-20250624.tar.gz
archive copy: sources-4/video-tools--zimg-snapshot-20250624.tar.gzlibdvdread-7.0.1.tar.bz2(90.8 KiB)
sha256b69f74d9ceea1ed173b579deba99f669c2cb42f3fd06d7d23b33ff222aa63763
upstream: https://github.com/HandBrake/HandBrake-contribs/releases/download/contribs2/libdvdread-7.0.1.tar.bz2
archive copy: sources-4/video-tools--libdvdread-7.0.1.tar.bz2libdvdnav-7.0.0.tar.bz2(83.8 KiB)
sha2561363cdfaf6e92c0b574579299b5480f5867fb32989451468a28f3f402ec48787
upstream: https://github.com/HandBrake/HandBrake-contribs/releases/download/contribs2/libdvdnav-7.0.0.tar.bz2
archive copy: sources-4/video-tools--libdvdnav-7.0.0.tar.bz2libbluray-1.4.0.tar.xz(447.8 KiB)
sha25677937baf07eadda4b2b311cf3af4c50269d2ea3165041f5843d96476c4c92777
upstream: https://github.com/HandBrake/HandBrake-contribs/releases/download/contribs2/libbluray-1.4.0.tar.xz
archive copy: sources-4/video-tools--libbluray-1.4.0.tar.xz
Dependencies
Depends on: python3, meson, ninja, cmake, nasm, autoconf, automake, libtool, m4, patch, pkgconf, gettext, glib, gtk4, libxml2, libass, harfbuzz, fribidi, freetype2, fontconfig, jansson, libjpeg-turbo, libogg, libvorbis, libtheora, x264, lame, opus, speex, libvpx, numactl, libdovi, bzip2, xz, zlib.
Required by: no port names it.
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-fdk-aac, line 26: fdk-aac (explained with the switches below)
Patches
build.sh applies these; kpkg applies nothing by itself.
system-libdovi.patch— Dropscontrib/libdovifrom the modulesmake/include/main.defsbuilds when the libdovi feature is on, so no libdovi is fetched or compiled, and adds the pkg-config moduledovito the librariesHandBrakeCLIlinks (test/module.defs). The GTK build already takesdovifrom pkg-config ingtk/meson.build.
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/44_apps/phase.env && kpkg install handbrake'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/video-tools/handbrake.
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/video-tools/handbrake
echo '12b046350f2422dc28783ff94229aff4ba5fe5e683431e057355d36163b2593a handbrake-1.11.2.tar.bz2' | sha256sum -c -
echo '2a8b8840c0bc78f5ed1576f98eba7df00c05f87fd6d07fad16efcd9333016edf ffmpeg-8.0.2.tar.bz2' | sha256sum -c -
echo 'a0882bb90826da62a96676c1a7cb7a7beb7f1db901f2775299cbeed03c3eb2a2 x265-snapshot-20260216-13309.tar.gz' | sha256sum -c -
echo '6c4c0c44ff0ba3d136d6f57f3a707f9de8e9c866f50f809c1d22a43f0d8c9583 SVT-AV1-v4.1.0.tar.gz' | sha256sum -c -
echo 'e099f53253f6c247580c554d53a13f1040638f2066edc3c740e4c2f15174ce22 dav1d-1.5.3.tar.bz2' | sha256sum -c -
echo '19a96cdc266466be58be86a9271bedb1f080bf4cc14f5ed58ac39dc5b970fd17 zimg-snapshot-20250624.tar.gz' | sha256sum -c -
echo 'b69f74d9ceea1ed173b579deba99f669c2cb42f3fd06d7d23b33ff222aa63763 libdvdread-7.0.1.tar.bz2' | sha256sum -c -
echo '1363cdfaf6e92c0b574579299b5480f5867fb32989451468a28f3f402ec48787 libdvdnav-7.0.0.tar.bz2' | sha256sum -c -
echo '77937baf07eadda4b2b311cf3af4c50269d2ea3165041f5843d96476c4c92777 libbluray-1.4.0.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/handbrake
SRC=$SRC_ROOT/handbrake-1.11.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf handbrake-1.11.2.tar.bz2 -C "$SRC" --strip-components=1
tar --no-same-permissions --warning=no-unknown-keyword -xf ffmpeg-8.0.2.tar.bz2 -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf x265-snapshot-20260216-13309.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf SVT-AV1-v4.1.0.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf dav1d-1.5.3.tar.bz2 -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf zimg-snapshot-20250624.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf libdvdread-7.0.1.tar.bz2 -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf libdvdnav-7.0.0.tar.bz2 -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf libbluray-1.4.0.tar.xz -C "$SRC_ROOT"
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 recipe’s helpers _hbc and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/system-libdovi.patch"
install -d download
for f in ffmpeg-8.0.2.tar.bz2 x265-snapshot-20260216-13309.tar.gz \
SVT-AV1-v4.1.0.tar.gz dav1d-1.5.3.tar.bz2 zimg-snapshot-20250624.tar.gz \
libdvdread-7.0.1.tar.bz2 libdvdnav-7.0.0.tar.bz2 libbluray-1.4.0.tar.xz; do
cp "$PORT_SRC/$f" download/
done
export CFLAGS="${CFLAGS/-std=gnu11/}"
./configure --prefix=/usr \
--disable-df-fetch \
--enable-gtk \
--enable-x265 \
--enable-numa \
--disable-fdk-aac \
--disable-nvenc \
--disable-nvdec \
--disable-qsv \
--disable-vce \
--enable-libdovi
make -C build
make -C build -j1 DESTDIR=$PKG install
for s in 32x32 128x128 256x256; do
install -Dm644 "gtk/icons/$s/apps/fr.handbrake.ghb.png" \
"$PKG/usr/share/icons/hicolor/$s/apps/fr.handbrake.ghb.png"
done
cat > "$PKG/usr/share/applications/fr.handbrake.ghb.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=HandBrake
GenericName=Video Transcoder
Comment=Convert video files and discs to MP4, MKV and WebM
Exec=ghb %f
Icon=fr.handbrake.ghb
Terminal=false
StartupNotify=true
StartupWMClass=fr.handbrake.ghb
Categories=AudioVideo;Video;
Keywords=transcode;convert;encode;video;dvd;bluray;handbrake;
DESKTOP
chmod 644 "$PKG/usr/share/applications/fr.handbrake.ghb.desktop"
The switches, and why each is set:
--disable-df-fetch— Make a contrib archive missing fromdownload/a build error instead of a download. Each archive is a source of this recipe, copied intodownload/under the name itscontrib/*/module.defsfetches; HandBrake checks each against the sha256 in that file as it extracts it.--enable-gtk— Build the GTK application,ghb, as well asHandBrakeCLI.--enable-x265— With--enable-numa: the x265 HEVC encoder, built at 8, 10 and 12 bit, with its NUMA support through numactl. Both are upstream’s Linux defaults, named.--disable-fdk-aac— No FDK AAC encoder. Enabling it builds HandBrake’s FFmpeg with--enable-nonfree, a binary that cannot be redistributed; FFmpeg’s own AAC encoder is used.--disable-nvenc— With--disable-nvdec,--disable-qsvand--disable-vce: no NVIDIA, Intel or AMD hardware encoder or decoder. Each needs a vendor SDK that is not a port.--enable-libdovi— Carry Dolby Vision metadata through a transcode, with libdovi. Upstream turns it on when it findscargoandcargo-c, and then builds its own libdovi withcargo fetch, which needs the network; withsystem-libdovi.patchthe libdovi port is linked instead.CFLAGS="${CFLAGS/-std=gnu11/}"— Remove the tree’s C standard fromCFLAGS. HandBrake’s make system addsCFLAGSto every C and C++ compile, its own and each bundled library’s, and each of those names its own standard (C flags handed to the C++ compiler).
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/handbrake, 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 handbrake-1.11.2-1.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/handbrake, and runs the triggers its paths call for.
Contents
Installed programs: HandBrakeCLI, ghb.
Installed directories: /usr/share/licenses/handbrake.
Notes
- Why the bundled libraries. HandBrake’s FFmpeg carries patches of its own (MP4 and MOV metadata, DVD and PGS subtitles, Dolby Vision RPU side data among them) that the ffmpeg port does not have, and
libhbis written against that one release. The other contribs are pinned the same way; the system’s copies of them are not used. - The menu icon. Upstream installs only the scalable icon and keeps the raster sizes in its tree;
build.shinstalls the 32, 128 and 256 pixel PNGs as well. - The menu entry is replaced to add
StartupWMClass=fr.handbrake.ghb, the application’s Wayland app_id, which upstream’s entry lacks. It claims no MIME type: a transcoder is opened on purpose, and the video types belong to the players.