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 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>
Links
Software
- Subtitle Edit (Windows, Linux)
- FFmpeg, which can write TTML (Windows, macOS, Linux)
Developers
- ttconv, Python, converts between TTML, IMSC, SRT, WebVTT and other caption formats
- imscJS, JavaScript, renders IMSC subtitles in web pages
- Shaka Player, JavaScript, which shows TTML subtitles in DASH streams