Files
marfrit-packages/arch/ffmpeg-v4l2-request-fourier/PKGBUILD
T
test0r 9e9447502e ffmpeg-v4l2-request-fourier: patch NV15→P010 unpack for Hi10P / Main10
The n8.1 pin's hwcontext_v4l2request.c deliberately blanks the
transfer-formats list for AV_PIX_FMT_YUV420P10 sw_format (the mapping
target for V4L2_PIX_FMT_NV15), so `ffmpeg -hwaccel v4l2request
-vf hwdownload,format=p010le` on a Hi10P / Main10 input failed at
filter-init with -22 EINVAL — even though kernel-side decode succeeded.

0002-nv15-to-p010-unpack.patch adds an inline NV15→P010 unpack
(5 bytes per 4 samples, little-endian → high-10-of-16) inside
v4l2request_transfer_data_from, exposes AV_PIX_FMT_P010 in
transfer_get_formats for that sw_format, and rejects non-P010
destinations explicitly with ENOSYS instead of silently corrupting
output via av_frame_copy on NV15-packed bytes.

Verified on fresnel (RK3399, linux-fresnel-fourier 7.0-14):
- 5-frame smoke test from issue #21 → exit 0, 13.8MB output
- 20-frame mid-fixture decode → bit-exact HW==SW
  sha256 7d9b66d48d8f17b2281da1881c663ecc31722bb218aba1ae23bf28d07aa66b08
- 8-bit baseline (bbb_60s_720p.h264.mp4) still bit-exact HW==SW (no
  regression in the existing NV12 path)
- Cross-device repro of original EINVAL on unpatched ampere (RK3588)
  pkgrel=4, confirming the bug is upstream-FFmpeg-side, not RK3399-specific

Patch is upstream-able to Kwiboo's v4l2-request-n8.1 branch.

Closes #21.
2026-05-18 08:35:19 +00:00

161 lines
4.0 KiB
Bash

# Maintainer: Markus Fritsche <mfritsche@reauktion.de>
#
# FFmpeg + V4L2-Request hwaccel (stateless video decode on Rockchip,
# Allwinner, etc) for the Fourier umbrella. Tracks Kwiboo's long-running
# rebase of Jernej Škrabec's v4l2-request patchset onto ffmpeg release
# tags. Pins the branch tip to a known commit for reproducible CI builds;
# bump _commit when upstream picks up a fix we want.
#
# Why this fork instead of AUR ffmpeg-v4l2-request-git:
# - AUR is pinned to 6.1.1 with epoch=2, which is OLDER than Arch's
# stock 2:8.1-3 → installing it downgrades system ffmpeg.
# - AUR pulls X11/AMF/CUDA/FireWire/AviSynth/OpenMPT/Bluray — irrelevant
# for a Wayland + ARM + video-decode fleet.
# - AUR uses #branch=..., no commit pin. CI artifacts are non-reproducible.
#
# Encoders (libx264/libx265/libvpx/libdav1d) kept per Fourier fleet policy.
# X11, AMF, CUDA, FireWire, AviSynth, OpenMPT, Bluray, OpenMAX, JPEG-XL,
# Theora, XVid, rsvg, soxr, ssh, vidstab, modplug, SDL2, Vulkan, JACK, GSM,
# Speex dropped — not needed on the Fourier fleet. (No SDL2 means no
# `ffplay` binary; mpv covers interactive playback.)
pkgname=ffmpeg-v4l2-request-fourier
_srcname=FFmpeg
_version='8.1'
_commit='b57fbbe50c9b2656fad86a1a7eeabfd2b2a50935' # v4l2-request-n8.1 tip 2026-04-24
pkgver=8.1.r123329.b57fbbe
pkgrel=5
epoch=2
pkgdesc='FFmpeg with V4L2 Request API hwaccel (Rockchip / Allwinner stateless decode)'
arch=('aarch64')
url='https://github.com/Kwiboo/FFmpeg'
license=('GPL-3.0-or-later')
depends=(
alsa-lib
bzip2
fontconfig
fribidi
gmp
gnutls
lame
libass.so
libdav1d.so
libdrm
libfreetype.so
libgl
libpulse
libva.so
libva-drm.so
libvorbis.so
libvorbisenc.so
libvpx.so
libwebp
libx264.so
libx265.so
libxml2
opus
v4l-utils
xz
zlib
)
makedepends=(
git
linux-api-headers
mesa
nasm
)
provides=(
libavcodec.so
libavdevice.so
libavfilter.so
libavformat.so
libavutil.so
libpostproc.so
libswresample.so
libswscale.so
ffmpeg
)
conflicts=(ffmpeg)
replaces=(ffmpeg ffmpeg-v4l2-request-git)
source=("git+https://github.com/Kwiboo/FFmpeg.git#commit=${_commit}"
'0001-libudev-bypass-fallback.patch'
'0002-nv15-to-p010-unpack.patch')
sha256sums=('SKIP' 'SKIP' 'SKIP')
pkgver() {
cd "${_srcname}"
printf '%s.r%s.%s' "${_version}" \
"$(git rev-list --count HEAD)" \
"$(git rev-parse --short=7 HEAD)"
}
prepare() {
cd "${_srcname}"
patch -Np1 -i "${srcdir}/0001-libudev-bypass-fallback.patch"
patch -Np1 -i "${srcdir}/0002-nv15-to-p010-unpack.patch"
}
build() {
cd "${_srcname}"
# FFmpeg's configure resolves the compiler via `which` and bakes the
# absolute path into generated makefiles, bypassing the makepkg
# /usr/lib/distcc/bin shim. Pass it explicitly so `BUILDENV=(distcc ...)`
# actually distributes; otherwise everything compiles locally.
local _ffmpeg_cc=gcc _ffmpeg_cxx=g++
if [[ ":$PATH:" == *":/usr/lib/distcc/bin:"* ]]; then
_ffmpeg_cc='distcc gcc'
_ffmpeg_cxx='distcc g++'
fi
./configure \
--prefix=/usr \
--cc="${_ffmpeg_cc}" \
--cxx="${_ffmpeg_cxx}" \
--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
make tools/qt-faststart
}
package() {
cd "${_srcname}"
make DESTDIR="${pkgdir}" install
install -Dm755 tools/qt-faststart "${pkgdir}/usr/bin/qt-faststart"
}