Repository navigation
Description
What happened?
A53 / CEA-608 cues appear to be timed on the item (post-shift) axis while stored in a field documented as container seconds, which would displace them by playlistShiftSeconds.
HLSSegmentProducer.swift:2482 packet.pointee.pts -= activeShift -> now ITEM axis
HLSSegmentProducer.swift:2862 observe(extracted, packet.pointee.pts, ...)
ClosedCaptions.swift:299 ingestA53(..., ptsSeconds: Double(pts) * scale, ...)
ClosedCaptions.swift:207 SubtitleCue(id: id, startTime: pts, ...)
PlayerState.swift:683 /// (start/end in container seconds)
The comment at HLSSegmentProducer.swift:2845-2846 says the timestamps are "still in the source time base", which is true of the units but not of the axis — the shift was subtracted upstream at :2482.
Magnitude measured on Fixtures/restart-witness-av.mp4: 83.3 ms, two frames at 24fps. Not a fixed constant — the shift is recomputed on every producer restart, so it would change after a seek.
One caveat on the evidence: the value flow is read from source and the shift magnitude is measured, but I have not reproduced the visible offset. The fixture carries no CEA-608, and provisionalDwell may mask it.
Steps to reproduce
- Play a source with embedded A53 / CEA-608 captions (H.264 or HEVC SEI) through the native path, so
HLSVideoEngineremuxes it. - Compare a cue's
SubtitleCue.startTimeagainst the source PTS of the picture it belongs to. - Expect a discrepancy of
playlistShiftSeconds; seek, and expect it to change.
Suggested regression witness: attach a53CaptionObserverForSession and assert the A53 pts matches the source axis rather than the post-shift one.
AetherEngine version or commit SHA
5098b39 (6.0.1)
Host app
Custom / my own integration
Platform
macOS
OS version
macOS 26.4
Device / chip
Apple M5 Pro
Playback path
Native (HLS remux → AVPlayer)
Source media
Fixtures/restart-witness-av.mp4 for the shift measurement (MP4 / H.264 High -bf 3 320x180 24fps / AAC mono / SDR BT.709). No A53-bearing source on hand.
Error codes / log lines
None — this is a timing discrepancy, not a failure. Found by reading the value flow and measuring the shift with swift test; the code path is platform-independent.
Activity
superuser404notfound commentedon Jul 30, 2026
Confirmed, and it does reproduce. Thanks for tracing this from source, the read was right at every step.
The missing piece was a caption-bearing clip, so I built one.
Scripts/fetch-fixtures.shnow injectsuser_data_registered_itu_t_t35SEI into a synthetic H.264 clip: acc_dataon every access unit, plus a complete pop-on sequence every 2 s held inside a single access unit, so the caption is atomic there and survives B-frame reordering. FFmpeg's own CEA-608 decoder reads the captions back out of it, so the fixture is spec-correct rather than merely parser-compatible.Against that clip the observer's timestamps land exactly one shift off the source axis:
Two frames at 24 fps, matching the magnitude you measured.
On the
provisionalDwellcaveat: it does not mask this. The dwell only extends a cue's end, the start is still the displaced pts, and every cue in the buffer moves by the same amount, so the result is a shift rather than a smear.Fix is in #262.
foldingShiftBackfolds the shift back at the observation site, mirroringsegmentIndex(forSourcePts:), which already does exactly that before comparing against the source-axis segment boundaries. Worth recording alongside it: both sibling feeds were already correct, which is why nothing pointed at this. The demuxable c608 tap gets its packet at the top of the read loop, before the rebase, and the software path reads decoded-frame side data where no shift exists at all. So the comment you flagged was accurate about the time base and wrong only about the axis.It also gets worse than the 83 ms on that clip. The shift is
firstActualVideoDts - desiredFirstVideoTfdt, recomputed per producer session, so a restart landing off its planned keyframe has been measured in seconds, and a source whose first DTS is not near zero (broadcast MPEG-TS, the case the A/53 path exists for) carries it from the first packet.Will note the release here once it ships.
Merge pull request #262 from superuser404notfound/fix/issue259-a53-so…
superuser404notfound commentedon Jul 30, 2026
Shipped in 6.1.4 (
80dd69c9, fix in52e33b7c).The witness clip lives in
Scripts/fetch-fixtures.shasa53-captions.mp4if it is useful on your side:Issue259A53CaptionAxisTestscompares the observer's timestamps against the source demuxer's for the same packets, and the whole thing is oneswift testaway since the fixture generator only needs ffmpeg.Leaving this open for a retest against a real A/53 source, since everything on this end was measured on a synthetic one.
fix(captions): put A/53 caption timestamps back on the source axis (s…
feat(api): report presentation times on both axes on the native path (s…
fix(hls): a composition lands on the base, not on the axis