feat(vmaf-tune): ADR-0498 follow-up #7 — encoder stats, x264 detection, backend dispatch, codec-list parser - #573
Merged
Conversation
…llow-up #7) Extend _VERSION_PROBE_PATTERNS to cover libx265 and libvpx-vp9 in addition to the existing libx264 and libsvtav1 entries, so _probe_encoder_version_from_ffmpeg can detect all three software encoder families from the ffmpeg -version configure summary. Add EncoderInfo dataclass (encoder, codec_detected: bool, version_label: str) and the public probe_encoder_info() helper that returns it. Callers can now check codec_detected directly instead of parsing the version label string. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ollow-up #7) _build_production_sample_extractor now accepts a backend kwarg and forwards it to run_score, so all 30 TPE probe-encode trials score on the same GPU backend as the mandatory verify pass. Previously the extractor always defaulted to CPU even when a GPU was available. _build_prod_predictor gains a backend kwarg forwarded to the extractor. fast_recommend (production path) calls select_backend once and passes the result to both the predictor and the verify pass. Remove the dead _ = backend stub from _gpu_verify that was left over from before the encode_runner forwarding was implemented. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… follow-up #7) Add codec_adapters.parse_available_codecs(stdout, *, restrict_to_known=True) that parses ffmpeg -hide_banner -encoders output into a frozenset of available codec names. This is the codec-list parser that was deferred from the initial codec_adapters scaffolding ("parser arrives in a follow-up"). When restrict_to_known=True (default) only names in the adapter registry are returned; set False to get the full encoder list. Also update the supports_encoder_stats Protocol comment to remove the "parser arrives in a follow-up PR" placeholder and clarify the current state (x264+x265 text formats supported; libvpx binary format deferred). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add test_adr_0498_followup7.py covering all four sub-tasks: - EncoderInfo fields and probe_encoder_info detection for x264/x265/libvpx-vp9 - _VERSION_PROBE_PATTERNS coverage assertions - build_pass1_stats_command duplicate-fallback_duration removal regression - _build_production_sample_extractor backend parameter signature - _gpu_verify dead stub removal via source inspection - backend forwarding to run_score via mock injection - parse_available_codecs parsing and frozenset contract Fix test_encode_dispatcher_per_adapter to capture only the first subprocess call (the encode argv); the probe-cache expansion for libvpx-vp9 adds a second ffmpeg -version call that would otherwise overwrite the captured cmd. ADR-0108 deliverables: - changelog.d/fixed/0498-vmaf-tune-adr-0498-followup7.md - docs/rebase-notes.md (no rebase impact, all changes fork-local) - AGENTS.md invariant notes for probe-cache expansion, backend kwarg, parser Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
lusoris
force-pushed
the
feat/vmaf-tune-adr-0498-followup-7
branch
from
June 3, 2026 21:40
9cb4054 to
c470023
Compare
lusoris
marked this pull request as ready for review
June 3, 2026 21:40
There was a problem hiding this comment.
Pull request overview
This PR is a vmaf-tune follow-up for ADR-0498 that tightens encoder capability probing, fixes a pass-1 stats command regression, ensures fast-path proxy trials score on the selected libvmaf backend, and adds an ffmpeg encoder-list parser to gate codec-specific behavior on runtime availability.
Changes:
- Add structured encoder probe results (
EncoderInfo+probe_encoder_info) and extend_VERSION_PROBE_PATTERNSto includelibx265andlibvpx-vp9. - Forward the selected scoring backend through the fast-path production sample extractor so TPE probe trials can score on GPU backends when available.
- Introduce
codec_adapters.parse_available_codecs()to parseffmpeg -hide_banner -encodersoutput into an available-codec set, and add regression tests.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/vmaf-tune/src/vmaftune/encode.py | Extends encoder configure-flag probing and adds EncoderInfo + probe_encoder_info; removes duplicate fallback_duration assignment. |
| tools/vmaf-tune/src/vmaftune/fast.py | Threads a backend kwarg into the production sample extractor and forwards it to run_score. |
| tools/vmaf-tune/src/vmaftune/codec_adapters/init.py | Adds parse_available_codecs() and updates codec stats-support documentation. |
| tools/vmaf-tune/tests/test_encode_dispatcher_per_adapter.py | Stabilizes subprocess argv capture by ignoring the follow-up ffmpeg -version probe call. |
| tools/vmaf-tune/tests/test_adr_0498_followup7.py | Adds regression coverage for all four sub-tasks (encoder probe, stats command, backend forwarding, codec parser). |
| tools/vmaf-tune/AGENTS.md | Documents new invariants for probing, backend forwarding, and codec parsing. |
| docs/rebase-notes.md | Records fork-local rebase impact notes for this feature. |
| changelog.d/fixed/0498-vmaf-tune-adr-0498-followup7.md | Adds changelog entry for the fixes and new helper/parser. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+233
to
+235
| flags, name = tokens[0], tokens[1] | ||
| if len(flags) >= 1 and flags[0] in ("V", "A", "S"): | ||
| found.add(name) |
Comment on lines
652
to
654
| sample_extractor=sample_extractor, | ||
| backend=_prod_backend, | ||
| ) |
Comment on lines
+230
to
+236
| return ScoreResult( | ||
| request=req, | ||
| vmaf_score=85.0, | ||
| feature_means={}, | ||
| exit_status=0, | ||
| stderr_tail="", | ||
| ) |
Comment on lines
+331
to
+332
| result = parse_available_codecs(_SAMPLE_FFMPEG_ENCODERS, restrict_to_known=False) | ||
| assert "libx264rgb" in result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_VERSION_PROBE_PATTERNSto coverlibx265andlibvpx-vp9in addition to the existing entries; addEncoderInfodataclass (encoder,codec_detected: bool,version_label: str) andprobe_encoder_info()public helper so callers checkcodec_detectedinstead of parsing the version string.fallback_durationassignment inbuild_pass1_stats_command(dead first write left by the fix(build): stop VMAF_VERSION degrading to a bare commit abbreviation #1266 refactor; second identical assignment overwrote it immediately).backendkwarg to_build_production_sample_extractorand forward it torun_score;_build_prod_predictorandfast_recommendforward the backend selected byscore_backend.select_backendso all 30 TPE probe-encode trials score on GPU when available. Remove dead_ = backendstub from_gpu_verify.codec_adapters.parse_available_codecs(stdout, *, restrict_to_known=True)that parsesffmpeg -hide_banner -encodersinto afrozensetof available codec names.Test plan
pytest tools/vmaf-tune/tests/test_adr_0498_followup7.py— 16 new tests, all pass.pytest tools/vmaf-tune/tests/test_encoder_stats_capture_x264.py— existing stats-capture tests still pass.pytest tools/vmaf-tune/tests/test_bbb_e2e_v2_bug_cluster.py— existing probe-cache tests still pass.pytest tools/vmaf-tune/tests/test_encode_dispatcher_per_adapter.py— all pass after fix to capture first subprocess call only.pytest tools/vmaf-tune/tests/test_fast.py— all pass.1499 passed, 16 skipped, 2 xfailed(pre-existingtest_format_both_json.pyfailure unrelated to this PR).Reproducer / smoke test
ADR-0108 deliverables checklist
tools/vmaf-tune/AGENTS.mdupdated with probe-cache expansion, backend kwarg, and codec-list parser invariantschangelog.d/fixed/0498-vmaf-tune-adr-0498-followup7.mddocs/rebase-notes.md— no rebase impact (all changes fork-local totools/vmaf-tune/)State.md
No bugs opened or closed by this PR; no state.md update required.
ffmpeg-patches
No public C-API surfaces, CLI flags, or meson_options.txt entries touched; no patch update required.
Semgrep note
The
semgrep-localhook was skipped viaSKIP=semgrep-localdue to a pre-existingio_uring_queue_initmemory allocation failure in the dev environment (documented in.pre-commit-config.yamllines 241-275 as a known systemRLIMIT_MEMLOCKissue). Manual verification viapython -m semgrep --config .semgrep.yml --error --quiet --jobs 1 <files>returns exit 0 on all changed files.🤖 Generated with Claude Code