What is Timed Text Markup Language?
Timed Text Markup Language (TTML) is an XML-based W3C format for captions and subtitles. It represents text timing, layout, styling, and placement in regions associated with media.
How Timed Text Markup Language works
TTML models a timed-text document as namespaced XML: a tt root whose head holds styling and layout declarations and whose body holds div, p, and span content elements that reference them. Those elements can carry begin, end, and dur attributes and act as parallel time containers by default, so a child’s times are offsets from the start of its nearest timed ancestor. Regions define the areas into which content is flowed. Because the full language is broad, profiles declare which features a document may use and a processor must support; IMSC defines a text profile and an image profile of TTML2 for subtitle and caption delivery. The W3C describes TTML as an interchange format among authoring systems that can also be used directly for distribution.
Key facts
- 1
begin,end, andduron a nested element are measured from the start of its nearest ancestor time container, which is parallel by default, not from the start of the media. Adivwithbegin="10s"therefore shifts every paragraph inside it by ten seconds, and a converter that reads only each paragraph’s own attributes places those cues early. - 2Time expressions that count frames depend on
ttp:frameRateon the root element. When it is absent, TTML2 falls back to an application-defined rate or else 30 frames per second, so a file authored at 25 frames per second without the attribute is mistimed; IMSC requires the attribute whenever frame-based times are used. - 3Profiles narrow the language, so a document that is valid TTML2 can still be rejected downstream. IMSC defines separate text and image profiles and prohibits some TTML2 features outright. HLS takes TTML only as IMSC1: the current HLS specification draft requires IMSC subtitle segments to be fragmented MP4 that complies with the IMSC1 Text Profile, signaled with a
CODECSidentifier such asstpp.ttml.im1t. - 4MDN documents the HTML
trackelement as taking WebVTT (.vtt) files, so plan on converting TTML or rendering it in script for browser playback. Players that support TTML do that work themselves: hls.js, for example, parses IMSC1 from fragmented MP4 segments and turns each timed element into a WebVTT cue object.
When Timed Text Markup Language matters
Choose TTML when a broadcast, player, or streaming workflow requires it and supports the needed profile. Browser playback often favors WebVTT, so direct TTML delivery may require conversion or player-specific support.
How Transloadit helps with Timed Text Markup Language
Transloadit’s subtitle-related Robots document SRT and WebVTT as their subtitle formats: /video/subtitle supports SRT and VTT subtitle files, and /speech/transcribe can output srt or webvtt.
The audio/video formats table lists ttml for writing only, not reading, on the FFmpeg stacks, so convert TTML sources to SRT or WebVTT before these Steps.
- Video subtitle Robot→
- Speech transcription Robot: format parameter→
- Audio/video formats by FFmpeg stack→
Explore Transloadit’s file formats & compression capabilities
Sources
- W3C: Timed Text Markup Language 2 (TTML2)
- W3C: TTML Profiles for Internet Media Subtitles and Captions 1.2 (IMSC 1.2)
- MDN: the track element (embed text track)
- IETF draft: HTTP Live Streaming 2nd Edition, section 3.1.5 IMSC Subtitles
- Apple: HLS Authoring Specification for Apple Devices (subtitle requirements)
- hls.js v1.6.13: src/utils/imsc1-ttml-parser.ts