Skip to content

Conversation

@cfsmp3
Copy link
Contributor

@cfsmp3 cfsmp3 commented Dec 19, 2025

Summary

Fixes a regression introduced in PR #1849 (commit 300f8ca) where WTV files with large initial PTS values would produce empty output.

Root cause: The WTV timing fix set min_pts and pts_set=2 (MinPtsSet) but didn't set sync_pts. The Rust timing code checks for PTS jumps by computing current_pts - sync_pts, and with sync_pts=0 but current_pts at a large value (e.g., 6039323550 for a file starting at 18:38:23), the difference triggered false PTS jump detection.

Fix: Set sync_pts to the same value as min_pts when first initializing timing.

Test results

Before (master):

Last sync PTS value: 0
Current PTS value: 6039323550
Note: You can disable this behavior by adding -ignoreptsjumps to the parameters.

Output: Empty file, progress showed -1118:-23 (negative hours!)

After (this fix):

  • Caption 1: 00:00:00,601 --> 00:00:02,801 ✅ Matches expected
  • Caption 2: 00:00:02,837 --> 00:00:06,305 ✅ Matches expected
  • Caption 3: 00:00:11,145 --> 00:00:12,411 ✅ Matches expected

Tested on all WTV samples in the test corpus - all produce correct output.

Test plan

  • CI regression tests pass for WTV section
  • Test 95 now passes (was showing empty result vs expected captions)

🤖 Generated with Claude Code

The previous WTV timing fix (commit 300f8ca) set min_pts and pts_set=2
(MinPtsSet) but didn't set sync_pts. This caused the Rust timing code
to detect a massive PTS jump when processing WTV files with large
initial timestamps (e.g., files recorded at 18:38:23).

The PTS jump detection computes (current_pts - sync_pts), and with
sync_pts=0 but current_pts=6039323550 (18:38:23 in PTS units), the
difference exceeded MAX_DIF and triggered the jump handling, resulting
in empty output.

This fix sets sync_pts to the same value as min_pts when first
initializing timing, preventing the false PTS jump detection.

Test results:
- Before: WTV files with large initial PTS produced empty output
- After: Timestamps match expected ground truth exactly
  (e.g., 00:00:00,601 --> 00:00:02,801 for first caption)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@cfsmp3 cfsmp3 merged commit f376862 into master Dec 19, 2025
27 of 30 checks passed
@cfsmp3 cfsmp3 deleted the fix/wtv-timing-sync-pts branch December 19, 2025 15:43
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.

2 participants