Files
marfrit-packages/debian/ffmpeg-v4l2-request-fourier/build-deb.sh
T
test0r 45f4b5e56f debian/ffmpeg-v4l2-request-fourier: new package
Mirror of arch/ffmpeg-v4l2-request-fourier into the Debian tree.
Same source pin (Kwiboo v4l2-request-n8.1 @ b57fbbe), same 2
patches (libudev-bypass-fallback + nv15-to-p010-unpack), same
configure flag policy (drop X11/AMF/CUDA/Bluray/Vulkan/SDL2/etc.
per Fourier fleet focus).

Output: single .deb at /usr/bin/ffmpeg + /usr/bin/ffprobe +
/usr/lib/aarch64-linux-gnu/libav*.so.61.  Conflicts/Replaces
the stock Debian ffmpeg + per-lib packages; takes epoch 2
(matches Debian's existing ffmpeg epoch).

Provides 'ffmpeg -hwaccel v4l2request' + '-hwaccel drm' routes
that drive rkvdec / hantro / cedrus / rpi-hevc-dec /
daedalus_v4l2 stateless decoders through libavcodec's hwdevice
DRM path, bypassing libva.  Required by mpv-fourier and
firefox-fourier as their backing FFmpeg; also the kdirect
bit-exact reference for libva-v4l2-request-fourier validation.

NOT strictly required for the VAAPI-only path on
daedalus-v4l2 hosts (stock Debian ffmpeg + libva-v4l2-request-
fourier covers that).  Install only when going firefox-fourier
or kdirect.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 19:01:18 +00:00

178 lines
6.1 KiB
Bash
Executable File

#!/bin/bash
# Build ffmpeg-v4l2-request-fourier_<ver>_arm64.deb (the Kwiboo FFmpeg
# fork with the V4L2-Request API hwaccel patches).
#
# Mirror of arch/ffmpeg-v4l2-request-fourier into the Debian tree.
# Provides the patched `ffmpeg` + `ffprobe` binaries plus the shared
# libav* libraries with v4l2-request support, so consumers like
# mpv-fourier (and the kdirect bit-exact reference test rig) work
# end-to-end without a stock-Debian FFmpeg fallback.
#
# Conflicts: ffmpeg, libav* — this is a drop-in replacement. Pi 5 /
# CM5 (BCM2712) hosts using daedalus_v4l2 + libva-v4l2-request-fourier
# DON'T strictly need this package (stock Debian ffmpeg + libva path
# is sufficient for the VAAPI route), but the kdirect bit-exact
# reference + firefox-fourier / mpv-fourier consumers do.
#
# Big build: 25-40 min on a runner. Output is a single .deb that
# bundles ffmpeg/ffprobe + libavcodec.so.61 + libavformat.so.61 etc.
# all together — no split per-library subpackages. Easier to consume,
# trades off finer-grained downgrades.
#
# Sibling Arch package: ../../arch/ffmpeg-v4l2-request-fourier/PKGBUILD
# Upstream: https://github.com/Kwiboo/FFmpeg (branch v4l2-request-n8.1)
set -euo pipefail
# Same pin as arch/ — v4l2-request-n8.1 tip 2026-04-24.
UPSTREAM_COMMIT=b57fbbe50c9b2656fad86a1a7eeabfd2b2a50935
FFMPEG_VERSION=8.1
# epoch 2 matches Debian's stock ffmpeg (currently 7:7.1.x in trixie);
# +rfourier suffix to avoid colliding with upstream/Debian rebuilds.
PKGVER=2:${FFMPEG_VERSION}+rfourier+gb57fbbe
PKGREL=1
HERE=$(dirname "$(readlink -f "$0")")
# Reproducible build. 2026-05-18 23:00 UTC — Phase 8.13 close.
export SOURCE_DATE_EPOCH=1779231600
work=$(mktemp -d)
trap "rm -rf $work" EXIT
cd "$work"
git clone --depth 1 \
--branch v4l2-request-n8.1 \
https://github.com/Kwiboo/FFmpeg.git FFmpeg
cd FFmpeg
# git fetch the specific commit (depth=1 of branch tip might not be it)
if [ "$(git rev-parse HEAD)" != "$UPSTREAM_COMMIT" ]; then
git fetch origin "$UPSTREAM_COMMIT"
git checkout "$UPSTREAM_COMMIT"
fi
# Apply patches (same as Arch).
patch -Np1 -i "$HERE/0001-libudev-bypass-fallback.patch"
patch -Np1 -i "$HERE/0002-nv15-to-p010-unpack.patch"
# Configure with Arch-parity flags. Drops the same set of features
# (X11, AMF, CUDA, FireWire, AviSynth, Bluray, OpenMPT, JPEG-XL,
# Theora, XVid, rsvg, soxr, ssh, vidstab, modplug, SDL2, Vulkan,
# JACK, GSM, Speex) — not needed on the Fourier fleet, keeps the .deb
# smaller and the dependency graph tighter.
./configure \
--prefix=/usr \
--libdir=/usr/lib/aarch64-linux-gnu \
--shlibdir=/usr/lib/aarch64-linux-gnu \
--incdir=/usr/include/aarch64-linux-gnu \
--disable-debug \
--disable-static \
--disable-doc \
--disable-stripping \
--enable-shared \
--enable-gpl \
--enable-version3 \
--enable-pic \
--enable-neon \
--arch=aarch64 \
--enable-libdrm \
--enable-libv4l2 \
--enable-libudev \
--enable-v4l2-request \
--enable-v4l2_m2m \
--enable-vaapi \
--enable-opengl \
--enable-gnutls \
--enable-fontconfig \
--enable-libass \
--enable-libfreetype \
--enable-libfribidi \
--enable-libxml2 \
--enable-libpulse \
--enable-libdav1d \
--enable-libopus \
--enable-libvorbis \
--enable-libmp3lame \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-libwebp \
--host-cflags='-fPIC'
make -j"$(nproc)"
make tools/qt-faststart
# Stage
ROOT="$work/pkgroot"
make DESTDIR="$ROOT" install
install -Dm755 tools/qt-faststart "$ROOT/usr/bin/qt-faststart"
# Doc
mkdir -p "$ROOT/usr/share/doc/ffmpeg-v4l2-request-fourier" "$ROOT/DEBIAN"
install -Dm644 "$HERE/debian/copyright" \
"$ROOT/usr/share/doc/ffmpeg-v4l2-request-fourier/copyright"
install -Dm644 "$HERE/debian/changelog" \
"$ROOT/usr/share/doc/ffmpeg-v4l2-request-fourier/changelog.Debian"
gzip -9 -n "$ROOT/usr/share/doc/ffmpeg-v4l2-request-fourier/changelog.Debian"
cat > "$ROOT/DEBIAN/control" <<EOF
Package: ffmpeg-v4l2-request-fourier
Version: ${PKGVER}-${PKGREL}
Section: video
Priority: optional
Architecture: arm64
Depends: libc6,
libdrm2,
libfontconfig1,
libfreetype6,
libfribidi0,
libxml2,
libpulse0,
libdav1d7 | libdav1d6,
libopus0,
libvorbis0a,
libvorbisenc2,
libmp3lame0,
libvpx9 | libvpx8 | libvpx7,
libx264-164 | libx264-163,
libx265-215 | libx265-209 | libx265-199,
libwebp7 | libwebp6,
libwebpmux3,
libass9,
libgnutls30,
libudev1,
libv4l-0,
libva2,
libva-drm2
Conflicts: ffmpeg, libavcodec61, libavformat61, libavutil59,
libswresample5, libswscale8, libavdevice61, libavfilter10,
libpostproc58
Replaces: ffmpeg, libavcodec61, libavformat61, libavutil59,
libswresample5, libswscale8, libavdevice61, libavfilter10,
libpostproc58
Provides: ffmpeg (= ${PKGVER}-${PKGREL}),
libavcodec.so.61,
libavformat.so.61,
libavutil.so.59
Maintainer: Markus Fritsche <mfritsche@reauktion.de>
Homepage: https://github.com/Kwiboo/FFmpeg
Description: FFmpeg with V4L2 Request API hwaccel (Kwiboo fork)
FFmpeg ${FFMPEG_VERSION} patched with the V4L2 Request API stateless
video decoder hwaccel — Kwiboo's long-running rebase of Jernej
Škrabec's v4l2-request patchset onto FFmpeg release tags.
.
Provides 'ffmpeg -hwaccel v4l2request' / '-hwaccel drm' routes that
drive rkvdec / hantro / cedrus / rpi-hevc-dec / daedalus_v4l2
stateless decoders directly through libavcodec's hwdevice DRM path,
bypassing libva. Used by mpv-fourier and firefox-fourier as their
backing FFmpeg, and as the kdirect bit-exact reference in libva-v4l2-
request-fourier validation.
.
Drops X11/AMF/CUDA/Bluray/JACK/Vulkan/SDL2/Theora/XVid/Speex/JPEG-XL
per Fourier fleet policy (Wayland + ARM + video-decode focus).
No 'ffplay' binary; mpv-fourier covers interactive playback.
EOF
DEB_OUT="ffmpeg-v4l2-request-fourier_${PKGVER//:/%3a}-${PKGREL}_arm64.deb"
dpkg-deb --root-owner-group --build "$ROOT" "$HERE/$DEB_OUT"
echo "built: $HERE/$DEB_OUT"