fix: detect -fps_mode in FFmpeg 9 help output

FFmpeg 9 lists the option as "-fps_mode[:<stream_spec>]", so the
whitespace-anchored probe missed it and every local run lost its frames.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
bradautomates 2026-09-25 09:14:15 +10:00
parent a9e2c460d0
commit c1975ef3b1
2 changed files with 4 additions and 3 deletions

View File

@ -117,9 +117,10 @@ def _sync_option(executable: str) -> tuple[str, str]:
result = run_text([executable, "-hide_banner", "-h", "full"], timeout=30)
if result.returncode == 0:
help_text = result.stdout + result.stderr
if re.search(r"(?m)^\s*-fps_mode\s", help_text):
# FFmpeg 9 lists options with stream specifiers, e.g. "-fps_mode[:<stream_spec>]".
if re.search(r"(?m)^\s*-fps_mode\b", help_text):
return "-fps_mode", "vfr"
if re.search(r"(?m)^\s*-vsync\s", help_text):
if re.search(r"(?m)^\s*-vsync\b", help_text):
return "-vsync", "vfr"
raise SystemExit(f"{executable} did not advertise -fps_mode or -vsync; check the FFmpeg installation. {diagnostic(result.stderr)}")

View File

@ -53,7 +53,7 @@ def test_invalid_probe_metadata(monkeypatch, data):
frames.get_metadata('test.mp4')
@pytest.mark.parametrize('help_text,expected', [('-vsync set video sync', '-vsync'), ('-fps_mode set fps\n-vsync set sync', '-fps_mode'), ('-fps_mode set fps', '-fps_mode'), ('unknown option: fps_mode', None)])
@pytest.mark.parametrize('help_text,expected', [('-vsync set video sync', '-vsync'), ('-fps_mode set fps\n-vsync set sync', '-fps_mode'), ('-fps_mode set fps', '-fps_mode'), ('-fps_mode[:<stream_spec>] set framerate mode for matching video streams', '-fps_mode'), ('unknown option: fps_mode', None)])
def test_sync_capability_probe(monkeypatch, help_text, expected):
calls = []
def help_run(cmd, **kw):