Skip to content

Subtitles over a remux: place embedded cues by the anchor keyframe's fed time - #1609

Open
tiper wants to merge 1 commit into
plxnative:mainfrom
tiper:side-reader-anchor-clock
Open

tiper wants to merge 1 commit into
plxnative:mainfrom
tiper:side-reader-anchor-clock

Conversation

@tiper

@tiper tiper commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

The side reader maps the original Part's clock onto a remux through the remux's first keyframe. Its anchor holds that keyframe's demuxed pts, but playhead_of reads a fed pts (the demuxed pts moved by pts_shift), so the anchor's playhead came out one pts_shift too far.

  • On a PMS remux, stamped from 0, the error is the first keyframe's own pts (83 ms on the file the 917 s test measures): every embedded cue over a remux, and a sidecar's measured delta, moved by it.
  • On a conversion that keeps the file's timestamps, the keyframe is stamped in film time, and after a seek or resume every embedded cue was placed a whole seek offset late and never drawn. Seen with a VobSub track over a Jellyfin audio conversion; the reporter's log: rebase: first post-seek keyframe pts=1970635000000 -> pts_shift=-1970635000000.

The anchor's pts is now moved to fed time (anchor_fed_pts) before the delta (measured_delta) and the judged clock read it.

Tests: a_film_time_conversion_keyframe_maps_the_part_one_to_one fails on the old mapping (delta = minus the offset) and passes now; a remux stamped from 0 reads as before. cargo test -p plx_media --lib subtitle_job: 12 passed.

…fed time

The side reader maps the original Part's clock onto a remux through the
remux's first keyframe. Its anchor holds that keyframe's demuxed pts, but
playhead_of reads a fed pts (the demuxed pts moved by pts_shift), so the
anchor's playhead came out one pts_shift too far. On a PMS remux, stamped
from 0, that is the first keyframe's own pts (83 ms on the file the 917 s
test measures), and every embedded cue and a sidecar's measured delta moved
by it. On a conversion that keeps the file's timestamps, the keyframe is
stamped in film time, and after a seek or resume every embedded cue was
placed a whole seek offset late and never drawn.

The anchor's pts is now moved to fed time before the delta and the judged
clock read it.

Signed-off-by: Tiago Pereira <1698241+tiper@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

1 participant