ADR-2166: Redesign FFmpeg patch series from 0001, drop Vulkan shims, and retire legacy libvmaf filter modifications¶
- Status: Accepted
- Date: 2026-10-31
- Deciders: maintainer (Issue #2435, Research-2166)
- Supersedes: ADR-0860
- Tags: ffmpeg, patches, vmafx, vulkan, breaking-change
Context¶
ADR-0726 removed the Vulkan compute backend from the VMAFx fork. However, ADR-0860 temporarily re-included patches 0004 (vulkan_device selector) and 0006 (libvmaf_vulkan filter) in ffmpeg-patches/series.txt as no-op shims to preserve context-line continuity across downstream patches (0005, 0008–0015).
Over time, this legacy series accrued significant maintenance overhead:
vf_libvmaf.cgrew to over 2400 lines through repeated fork-specific option and backend additions.- Context lines referenced dead Vulkan shims and configure probes for non-existent headers.
- ADR-2125 introduced the unified
vmafx,vmafx_tune, andvmafx_prefilters on the modern VMAFx C API (--enable-libvmafx), rendering all modifications tovf_libvmaf.cobsolete. - Upstream FFmpeg unpatched builds already maintain their own stock
libvmaffilter linking against thelibvmaf.so.3backwards-compatibility library.
Issue #2435 mandates eliminating all fork modifications to vf_libvmaf.c, removing every vmaf-named filter and option added by the fork, and restructuring the patch stack into a clean, consecutive series beginning at 0001.
Decision¶
-
Drop Vulkan shims and retire all
vf_libvmaf.cmodifications: Permanently remove0004and0006(the Vulkan shims) and all 17 other obsolete patches that modifiedvf_libvmaf.cor added legacyvmaf-named filters (libvmaf_sycl,libvmaf_vulkan,libvmaf_metal,libvmaf_tune,vmaf_pre,-vmaf-profile). ADR-2166 supersedes ADR-0860. -
Renumber and rebuild the series from
0001grouped by purpose with no numbering gaps: The active patch series inffmpeg-patches/series.txtconsists solely of: 0001-codec-qpfile-unified.patch(formerly0007): Generic per-frame-qpfileoption across libx264, libsvtav1, and libaomenc. Renamed to removelibvmaf-tuneprefix.0002-pass-autotune-cli-glue.patch(formerly0009): Generic-pass-autotuneCLI glue.0003-add-vmafx-profile-cli-glue.patch(formerly0025):-vmafx-profileCLI helper.0004-add-vmafx-filter.patch(formerly0023):vmafxscoring filter andvmafx_tuneCRF recommendation filter onlibvmafx.0005-add-vmafx-pre-filter.patch(formerly0024):vmafx_prelearned filter onlibvmafx.-
0006-fftools-loopback-decoder-hwaccel.patch(formerly0026): Hardware-accelerated decoding preceding-decloopback decoders (retained in fork per ADR-2125 decision Q-048). -
Port colorimetry passing to
vf_vmafx.c: The AVFrame colorimetry mapping capability from legacy patch0022(ADR-2093) is ported directly toffmpeg-patches/src/vf_vmafx.c, declaring color range, primaries, transfer characteristics, and matrix to the VMAFx engine on both inputs. -
Fork FFmpeg builds configure solely
--enable-libvmafx: All fork container images, dev containers, CI workflows, and documentation configure--enable-libvmafx. All backend-specific configure flags (--enable-libvmaf-*) are removed. -
Upstream compatibility preserved: Unpatched upstream FFmpeg retains its own stock
libvmaffilter (--enable-libvmaf) linking against thelibvmaf.so.3backwards-compatibility library.
Consequences¶
- Positive:
- Zero dead code or no-op shims; 19 obsolete patches removed.
- Zero modifications to
vf_libvmaf.c, eliminating upstream merge conflicts in the core FFmpeg filter. - Strict consecutive numbering
0001to0006with no gaps. - Single
--enable-libvmafxconfigure flag replaces multi-flag backend configurations. - Negative / Breaking change:
- Legacy filters (
libvmaf_sycl,libvmaf_cuda,libvmaf_metal,libvmaf_tune,vmaf_pre) and CLI options (-vmaf-profile,--enable-libvmaf-*) are removed from fork FFmpeg builds. - Users migrate to
vmafx,vmafx_tune,vmafx_pre, and-vmafx-profilefollowing the migration guide indocs/usage/ffmpeg.md.
References¶
- ADR-0726 (drop Vulkan backend)
- ADR-0860 (superseded: no-op Vulkan shims)
- ADR-1852 (VMAFx API redesign)
- ADR-2093 (AVFrame colorimetry forwarding)
- ADR-2125 (VMAFx FFmpeg filters)
- Research-2166 (FFmpeg patch series measured audit)
- Issue #2435 (FFmpeg patch series redesign)
docs/usage/ffmpeg.md(Migration guide)