Because Teletext subtitles are 'sparse' (data only exists when text is displayed), Shaka Packager uses a 'heartbeat' mechanism to ensure continuous text segments and proper alignment with video segments. This mechanism is automatic when processing MPEG-TS files containing both video and teletext streams.
To control the timing offset between video timestamps and text segment generation, use the --ts_ttx_heartbeat_shift parameter.
- Default:
90000 (at 90kHz timescale, equivalent to 1 second). - When to increase: If text segments are generated too late (later than video segments).
- When to decrease: If some text cues are missing from the output.
Note: For best results and automatic segment alignment, always include the video and teletext streams from the same MPEG-TS source in the same packager invocation.
# Example with custom heartbeat shift (3 seconds)
$ packager \
--ts_ttx_heartbeat_shift 270000 \
'in=input.ts,stream=video,init_segment=v/init.mp4,segment_template=v/$Number$.m4s' \
'in=input.ts,stream=audio,init_segment=a/init.mp4,segment_template=a/$Number$.m4s' \
'in=input.ts,stream=text,cc_index=888,lang=en,init_segment=t/init.mp4,segment_template=t/$Number$.m4s'