Skip to content

Remote-HLS subtitle anchor: separate muxer delay from keyframe-restart gap #763

Open

Description

@superuser404notfound

Summary

The remote-HLS subtitle proxy anchors injected WebVTT renditions with X-TIMESTAMP-MAP from a probe of the segment the load opens on (Silo-Server#14). That probe observes one number, D - G, where the map needs D alone:

  • D is the muxer delay, constant for the session (ffmpeg MPEG-TS: 1.4 s by default, 10 s with -max_delay 5000000; fMP4: 0).
  • G is the keyframe-restart gap: how far before its playlist slot the first segment of a started or restarted transcode begins, when the origin restarts at the keyframe before the slot (Jellyfin-style -noaccurate_seek -copyts). Only that first segment carries it.

renditionAnchor(measured:) applies only a positive measurement, which is exact when D == 0 or G == 0. When both are nonzero:

  • 0 < G < D: the map is D - G, every cue shows G early, AE#616 measures about 0, and sourceTime also leads by G.
  • G > D: the plain body shows every cue D early, AE#616 measures G - D, and sourceTime is off by D.

AE#616 cannot see either error, because it measures item time against the same cues and its reference moves with the map. An MPEG-TS origin with a muxer delay that resumes by restarting at the previous keyframe hits this on every resumed load. Silo's own HLS output keeps G = 0, so this concerns third-party origins.

Proposed direction

Probe the segment after the start segment as well: same job, AVPlayer requests it next anyway, and it carries D without G, provided the origin forces keyframes on slot boundaries. Stream copy does not, so it needs a fallback there (for example: only trust the second segment when its measurement is consistent with its slot, otherwise keep the current rule).

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions