Skip to content

feat(ffmpeg-patches): take generic FFmpeg fixes from the shared fix series - #294

Merged
lusoris merged 1 commit into
masterfrom
feat/shared-ffmpeg-series
Oct 10, 2026
Merged

lusoris merged 1 commit into
masterfrom
feat/shared-ffmpeg-series

Conversation

@lusoris

@lusoris lusoris commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

What & why

The Pelorus FFmpeg stack now applies on top of the shared FFmpeg fix series instead of carrying its own copies of generic fixes. The series is VMAFx/ffmpeg-patches v0.1.0-rc.1: four patches on the same n9.0.2 base, which vmafx applies too. ADR-0185 records the decision and the alternatives.

  • Pin and verification: build-config.env pins the series by tag, commit and tarball sha256. scripts/fetch-ffmpeg-series.sh fails closed unless the sha256 pin, the cosign signature of SHA256SUMS, the build attestation and the FFmpeg base all check out. Every script, image build and CI job that patches FFmpeg applies the series first.
  • 22 patches: patch 0021 is dropped, because series patch 0001 is the same diff. Its number stays unused, and 0022 and 0023 keep theirs, since documents, ADRs, the tester and v0.4.0-rc.2 cite them.
  • Patch 0022 shrinks to one call behind the series' NVENC code. The zero-free carrier and the map stripping stay; the hevc_nvenc budget and the drop are series patches 0003 and 0004. Patches 0004, 0008 and 0011 change in context only.

What changes for users: h264_nvenc and hevc_nvenc with -udu_sei 1 no longer write a user data SEI from another producer that NVENC would truncate; they warn instead. Regenerating or replaying the stack needs network access, cosign and an authenticated gh.

Reviewer decisions:

  1. The ADR's Implementation: pending line points at the epic [EPIC] Upstream and rebases (ongoing) #129, because no issue tracks this switch. Name another issue if you prefer one.
  2. Patch 0022 makes one more short-lived allocation per Pelorus blob. That is the price of a hook that edits no series line (ADR-0185, Consequences).

Reproducer / smoke-test

scripts/fetch-ffmpeg-series.sh --self-test                 # needs network, cosign, gh auth
meson test -C build --suite=fast fetch-ffmpeg-series-fail-closed build-config-sync sei-fit
FFMPEG_REPO=/absolute/path/to/ffmpeg ffmpeg-patches/generate.sh            # twice: no diff
FFMPEG_REPO=/absolute/path/to/ffmpeg ffmpeg-patches/test/build-and-run.sh  # 4 series + 22 Pelorus patches
Check Result
Verifier self-test genuine release accepted; flipped byte, moved pin, wrong pin, tampered SHA256SUMS and wrong commit each refused at their own check; with each check switched off, the self-test fails
Offline verifier test (fast suite) 13 planted defects refused, control accepted; with each check switched off, the test fails
generate.sh, twice byte-identical to the committed 22 patches
build-and-run.sh 4 series and 22 Pelorus patches applied, FFmpeg linked, registrations present, NVENC smoke 6 of 6 on an RTX 4090 (driver 615.78.08)
Tester sidedata_roundtrip hevc_nvenc and h264_nvenc pass, 5 of 5 cases each; the tester's QSV legs were not_run on this three-GPU host
hevc_qsv, h264_qsv smoke (Arc A380) 8 of 8 pictures carry the blob
qsv-roi-regression.sh pass
Tester image build stage pin checked again in the image, 26 patches applied; the three kits build in this pull request's Tester publish job
CI on this pull request ffmpeg-stack (verifier self-test with the default token, regeneration without diff, replay), lavapipe and the three tester kits pass
make verify-all, reuse lint green

Details are in research 0185. Raw logs are local, in .workingdir/evidence/shared-series-switch/.

Per-PR checklist (ADR-0100 / ADR-0108 — see CONTRIBUTING.md)

  • ADR: ADR-0185 (Proposed), indexed in docs/adr/README.md
  • Per-surface docs: docs/development/build.md (new section), docs/development/tester-image.md, docs/usage/ffmpeg.md, docs/backends/vulkan.md, docs/licensing.md, README.md, ffmpeg-patches/README.md
  • Research digest: docs/research/0185-shared-ffmpeg-fix-series.md
  • Decision matrix: ADR-0185 alternatives table
  • AGENTS.md invariant note: ffmpeg-patches/AGENTS.md invariants 9 and 10, root AGENTS.md hard rule 5
  • Changelog fragment: changelog.d/changed/0185-shared-ffmpeg-fix-series.md; --check passes
  • Rebase note: first entry of docs/rebase-notes.md
  • Patch-stack sync: regenerated twice, byte-identical; full replay passes (no libpelorus surface changed)
  • Interop ABI: untouched
  • VMAFx mirror: n/a, no mirrored file touched
  • Shader source: untouched
  • Touched files lint-clean; make verify-all green
  • Conventional Commit subject; signed off; not committed to master

Reviews

  • ffmpeg-patch-reviewer: no defect in the patch 0022 hook (ownership on every path, budget, interplay with the series' drop). Its findings are fixed in this commit: a sei-fit case for the hook path the GPU smoke cannot reach, a length guard that does not depend on the width of size_t, a patch-count assertion after the tester image's apply loop, and the notes in ADR-0181 and ADR-0183 moved to their headers.
  • doc-reviewer: its findings are fixed: the script's variables and --unpack mode in the build guide, the series tarball in the -source image list, the decoder wording in docs/usage/ffmpeg.md, and a note in docs/rebase-notes.md that older entries predate the 22-patch stack.
  • pr-body-checker: deliverables, commit message and checklist pass; this summary was shortened on its finding.

…eries

The Pelorus stack carried its own copies of fixes that are not Pelorus
features: the Vulkan queue family fix (patch 0021) and the hevc_nvenc
user data SEI budget inside patch 0022. vmafx needs the same fixes, and
a fix kept in two stacks drifts. They now come from one place, the
shared FFmpeg fix series VMAFx/ffmpeg-patches (ADR-0185).

The stack applies on top of release v0.1.0-rc.1 of that series, pinned
in build-config.env by tag, commit and tarball sha256. One script,
scripts/fetch-ffmpeg-series.sh, downloads the release and fails closed
unless the sha256 pin, the cosign signature of SHA256SUMS, the build
attestation (gh attestation verify) and the FFmpeg base all check out.
generate.sh, build-and-run.sh, qsv-roi-regression.sh, the tester image
build and the CI stack jobs apply the series first, then series.txt,
and check-build-config.py refuses a version of each that does not.

Stack changes:

- Patch 0021 is dropped: series patch 0001 is the same diff. Its number
  stays unused, and 0022 and 0023 keep theirs, because documents, ADRs,
  the tester and v0.4.0-rc.2 cite them. generate.sh formats the range
  above the series tip and maps its output to the names by position.
- Patch 0022 becomes one call between the series' av_memdup() and
  nvenc_hevc_sei_fits(): it writes a Pelorus blob as its zero-free
  carrier and, on hevc_nvenc, strips the maps of a blob that does not
  fit. The budget and the drop are series patches 0003 and 0004.
- Patches 0004, 0008 and 0011 change in context only.

Behaviour that changes: h264_nvenc and hevc_nvenc no longer write a
user data SEI from another producer that NVENC would truncate; they
warn instead (series patch 0004). Regenerating or replaying the stack
now needs network access, cosign and an authenticated gh. The NOTICE of
the released patch archive names the series the stack needs first.

Checked: the verifier refuses a flipped byte, a moved pin, a tampered
SHA256SUMS and a wrong commit, and its offline checks refuse 13 planted
defects in the fast suite; generate.sh is byte-stable; the full replay
links FFmpeg and passes the NVENC smoke on an RTX 4090; the tester's
sidedata_roundtrip passes on hevc_nvenc and h264_nvenc (research 0185).

Refs #129

Signed-off-by: lusoris <lusoris@proton.me>
@lusoris
lusoris merged commit 50b625b into master Oct 10, 2026
16 checks passed
@lusoris
lusoris deleted the feat/shared-ffmpeg-series branch October 10, 2026 11:30
@lusoris lusoris mentioned this pull request Oct 11, 2026
12 tasks done
lusoris added a commit that referenced this pull request Oct 11, 2026
Pelorus 0.4.0-rc.3 is the third release candidate of 0.4. The interop
ABI stays at 1.5.

Since rc.2 it adds `tiling=drm` output pools on the six filters that
write new frames, so `hwmap` reaches VAAPI and QSV without a download
(#292). The FFmpeg patch stack now applies on top of the shared FFmpeg
fix series v0.1.0-rc.1 (ADR-0185, #294); with series patch 0004, NVENC
no longer writes a foreign user data SEI that it would truncate. The
documented recipes for hardware encoders no longer use `hwdownload`
(#295), and the Praetor engine is pinned at 7cf9cbb2 and runs through
its own launcher (ADR-0187, #297).

The two known issues of rc.2 still hold and stay in the notes: the
intermittent h264_qsv crash with SEI payloads inside Intel's QSV
runtime, and VMAFx readers on ABI 1.4 ignoring the NVENC carrier until
VMAFx re-pins (VMAFx/vmafx#2708).

The six changelog fragments are rotated into the [0.4.0-rc.3] section,
which the release build reads as the notes. meson.build and
PELORUS_VERSION_STR carry 0.4.0-rc.3; the version numbers stay 0, 4, 0.

Signed-off-by: lusoris <lusoris@proton.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant