Fix #13: use picture frame rate for field-coded interlaced sources#44
Merged
Merged
Conversation
DVB-T PAL rips stored as "separated fields" (field-coded H.264) report ffprobe r_frame_rate as the *field* rate (50 for 25fps PAL, 59.94 for 29.97fps NTSC), while avg_frame_rate carries the true picture rate. VapourBox read r_frame_rate everywhere, so it treated the source as 50p: the deinterlace panel showed 50i and — because the pipe-source template forces the clip to the detected fps — QTGMC double-rate targeted 100fps with a doubled, desynced frame count. Add FieldOrderDetector.selectFrameRate(r, avg): when r is ~2x avg (the field-coded signature, ratio 1.8-2.2) trust avg, otherwise keep r so CFR progressive and frame-coded interlaced are unaffected. Wire it into getVideoInfo and the preview generator's probe. Tests: - 6 unit tests for selectFrameRate (PAL/NTSC field-coded, 50p, 25i, null). - A real-clip test on the issue's DVB-T2 sample (trimmed, stream-copied to preserve the field-coded bitstream) asserting 25fps, interlaced, TFF. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
Issue #13: a DVB-T2 PAL rip deinterlaces to 100fps instead of 50fps.
The source is 25fps interlaced H.264 stored as "separated fields" (field-coded). ffprobe reports its
r_frame_rateas the field rate (50/1), whileavg_frame_ratecarries the true picture rate (25/1) — a well-known ffprobe quirk for field-coded streams. VapourBox readr_frame_rateeverywhere, so it treated the source as 50p:fps_num={{INPUT_FPS_NUM}}), QTGMC double-rate targeted 100fps, with a doubled, desynced frame count.The owner's own files aren't affected because they're frame-coded (
r_frame_rate=avg_frame_rate= 25).Fix
Add
FieldOrderDetector.selectFrameRate(r, avg): whenris ~2×avg(the field-coded signature, ratio 1.8–2.2) trustavg; otherwise keeprso true 50p progressive and frame-coded 25i are untouched — no regression to working workflows. Wired intogetVideoInfo(fixes display,inputFrameRate→clip fps, andframeCount) and the preview generator's probe (seek accuracy).Tests
selectFrameRate(PAL/NTSC field-coded, true 50p, frame-coded 25i, null fallbacks).Tests/TestResources/pal-dvbt-fieldcoded-25i.ts, trimmed with stream copy to preserve the field-coded bitstream — assertinggetVideoInforesolves to 25fps,interlaced, TFF.🤖 Generated with Claude Code