HLS WebVTT: map a subtitle cue to the correct media moment

You search a subtitle file for a quoted sentence and find a cue at 13.5 seconds. Seeking to 13.5 seconds in a downloaded video produces different words. The subtitle may be wrong, but there is another possibility to check first: its clock may have a different origin from the media clock.

For an HLS WebVTT subtitle, inspect X-TIMESTAMP-MAP before using cue times as video positions. It connects a local subtitle time to a media timestamp. The result helps locate the passage; it does not supply a recording date or verify the quotation.

Amber subtitle blocks and turquoise film windows on two offset strips joined by a brass alignment pin
AI-generated conceptual illustration of a shared anchor between offset timelines; the spacing is not a measured example.

Keep the cue with the header that explains its time

A WebVTT cue has start and end offsets followed by its text. The W3C WebVTT draft describes the cue format. HLS adds a mapping between a LOCAL cue time and a MPEGTS timestamp. RFC 8216, section 3.5, specifies this relationship. LOCAL is a subtitle clock value; it does not mean the timezone of a person or place.

Preserve the subtitle resource, its complete header or applicable initialization resource, the subtitle playlist and the corresponding media reference. Record the language and rendition—the particular version of the stream. A line copied from search results may omit the header that makes its timing useful.

For a live stream, keep the observed playlist and collection time as well as its URL. Returning to a changing URL later may give you a different set of segments. Do not combine the subtitle from one rendition or recording with an unrelated video merely because their titles match.

Work through one mapped cue

This entire example is synthetic. It demonstrates arithmetic on a continuous timeline; it is not a captured broadcast or a test of a player.

WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:12.000,MPEGTS:900000

00:00:13.500 --> 00:00:15.000
The eastern gate is open.

The header pairs 12 seconds on the subtitle clock with 900,000 media ticks. For this MPEG timestamp scale, one second is 90,000 ticks; the Shaka Player WebVTT implementation uses that scale and applies additional timing context when placing cues in a player.

Within this example’s continuous, non-wrapping interval, subtract the LOCAL anchor, convert the difference into ticks, and add the MPEGTS anchor:

mapped ticks = 900000 + (cue seconds - 12) × 90000
BoundaryCue timeDifference from LOCALMapped media ticks
Start13.500 s1.500 s1,035,000
End15.000 s3.000 s1,170,000

Dividing these results by 90,000 gives 11.5 and 13.0 seconds on that transport-clock scale. The cue still spans 1.5 seconds. We checked these values with exact rational arithmetic in the local exercise; no real audio was assessed.

The two-second difference is not evidence that someone shifted the spoken words. It follows directly from the two anchors in the header. Keep that mathematical result separate from any later listening judgment.

Why 11.5 seconds may still be the wrong seek position

A player can present a timeline whose zero is elsewhere. Suppose, solely for this exercise, that playback zero corresponds to media tick 810,000 and that no other offset or discontinuity applies. The same cue would then occupy:

start = (1035000 - 810000) / 90000 = 2.5 s
end   = (1170000 - 810000) / 90000 = 4.0 s

Here 13.5 is the subtitle value, 11.5 is the mapped transport value in seconds, and 2.5 is the conditional player position. They identify the same boundary under the stated assumptions. Without evidence for the player origin, stop at the mapped media interval; do not guess the final seek position.

Use a player that correctly handles the preserved HLS material, or ask a reviewer who can inspect its timing context to establish that last connection. Confirm the selected media segment and replay the surrounding speech. A standalone VTT file loaded beside an unrelated MP4 is not a test of the original HLS synchronization.

Know when the simple calculation stops applying

RFC 8216 defines a zero-to-zero fallback when the map is absent and warns about the 33-bit media timestamp wrapping. First establish that you have the complete applicable header: an excerpt without the map does not prove the source omitted it. Across a wrap or a stream discontinuity, inspect the relevant timing context instead of extending this exercise’s single offset indefinitely.

Another limit is the copy you are using. An extracted or edited video may have a new time origin. If the question is an interval between particular frames within that file, use the frame-timestamp workflow. A subtitle mapping and a frame-interval calculation answer different questions.

Turn the subtitle hit into a checkable quotation

Keep a short locator beside the quotation: source and rendition, preserved subtitle and header, raw cue range, mapping calculation, associated media segment, and the player position only when established. Add what you actually heard in context. If you only inspected text, label the quotation as subtitle text with audio unchecked.

The next action is to replay the sentence with the preceding question and the following response. A cue can contain a transcription mistake, and its timing does not identify the speaker. If the disputed claim depends on a cut between shots, the video sequence comparison guide helps examine that edit. Preserve the mapped locator so another person can return to the same passage.

Author: OSINT Jet · Primary sources reviewed 24 November 2026