test: tolerate FFmpeg 7.1 muxing the shifted-PTS fixture one frame short

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
bradautomates 2026-09-25 09:26:23 +10:00
parent c1975ef3b1
commit 19b517fd49

View File

@ -102,7 +102,8 @@ def test_nonzero_input_pts_are_source_relative(tmp_path):
subprocess.run(['ffmpeg', '-v', 'error', '-f', 'lavfi', '-i', 'testsrc2=s=160x120:r=10:d=3', '-vf', 'setpts=PTS+7/TB', '-c:v', 'libx264', str(clip)], check=True) subprocess.run(['ffmpeg', '-v', 'error', '-f', 'lavfi', '-i', 'testsrc2=s=160x120:r=10:d=3', '-vf', 'setpts=PTS+7/TB', '-c:v', 'libx264', str(clip)], check=True)
out = frames.extract(str(clip), tmp_path / 'f', fps=1, max_frames=3) out = frames.extract(str(clip), tmp_path / 'f', fps=1, max_frames=3)
assert [f['timestamp_seconds'] for f in out] == [0, 1, 2] assert [f['timestamp_seconds'] for f in out] == [0, 1, 2]
assert frames.get_metadata(str(clip))['duration_seconds'] == 3 # FFmpeg 7.1 muxes this shifted clip one frame (0.1s) short; either is source-relative, 10 would not be.
assert 2.9 <= frames.get_metadata(str(clip))['duration_seconds'] <= 3
@pytest.mark.parametrize('fps', [float('nan'), float('inf'), -1, 0]) @pytest.mark.parametrize('fps', [float('nan'), float('inf'), -1, 0])