Introduction
TTML, the Timed Text Markup Language, is an XML format for subtitles and captions specified by the W3C. It is used mainly by broadcasters and streaming services, where subtitles are delivered to many kinds of player. Profiles of TTML include IMSC, used in MPEG-DASH and CMAF streams, SMPTE-TT and the EBU’s EBU-TT.
The first version of TTML was originally called DFXP, the Distribution Format
Exchange Profile, and files with the .dfxp extension are TTML. Some
services also deliver TTML as .xml files.
Structure
The full reference covers TTML1 and TTML2 together, marking what TTML2 added:
- Document structure – namespaces, the content elements and their attributes, conditions
- Timing – time expressions, timing attributes, time base, frame and tick rates
- Styling – style elements, how styles apply, and all 51 style attributes
- Style values – colours, lengths, fonts, borders, shadows and emphasis
- Layout and regions – regions, which region text goes to, cell resolution
- Animation –
set,animateand their attributes - Embedded content – TTML2 fonts, images, audio, data and audio styles
- Metadata – titles, agents, names and roles
- Profiles and features – profile designators, features, IMSC
The root element is tt in the namespace
http://www.w3.org/ns/ttml, with an xml:lang attribute. The
optional head holds styling, with named styles using
attributes such as tts:color and tts:fontStyle, and
layout, with the regions of the screen where text can appear. The
body holds div elements of p paragraphs, each
with begin and end times; br breaks a line and
span styles part of it.
<tt xmlns="http://www.w3.org/ns/ttml" xmlns:tts="http://www.w3.org/ns/ttml#styling" xml:lang="en">
<body>
<div>
<p begin="00:00:01.000" end="00:00:03.500">Where are we going?</p>
<p begin="00:00:04.000" end="00:00:06.250"><span tts:fontStyle="italic">Somewhere we have never been.</span></p>
</div>
</body>
</tt>
Not described
The pages follow the W3C TTML2 Recommendation, TTML1 third edition and IMSC 1.2, all public.
Known, not yet covered
- Reference: the end of section 14 and the appendices of TTML2 were not reached by the page text that was read: the TTML2 feature list (Appendix E) and extension list, the effect of
ttp:inferProcessorProfileMethodloose against strict, and theignorecombination method. Only TTML1’s features are listed. - Reference:
ttp:version(described in drafts but not in the TTML2 Recommendation’s parameter list as read), the grammar of thetta:pitchvalue (only its initial value 0% was read) and the definition ofaltTextbeyond IMSC’s note. - Viewer: there is no TTML viewer plugin yet; the explorer shows the file as XML text.
Links
Software
- Subtitle Edit – free subtitle editor that opens, edits and converts TTML and DFXP (Windows, Linux)
- FFmpeg – command-line tools that can write TTML (Windows, macOS, Linux)
Developers
- ttconv – converts between TTML, IMSC, SRT, WebVTT and other caption formats (Python)
- imscJS – renders IMSC subtitles in web pages (JavaScript)
- Shaka Player – web player that shows TTML subtitles in DASH streams (JavaScript)
Reference
- Timed Text Markup Language 2 (TTML2) – the current W3C specification
- Timed Text Markup Language 1 (TTML1) – the first W3C version, once called DFXP