TTML and DFXP to SRT
Convert TTML and DFXP captions to SRT, with the timing read correctly
Drop .ttml, .dfxp or timed-text .xml files and get clean SRT back. Clock times, frame counts and tick values are all converted to real milliseconds, line breaks and nested spans become cue text, and a warning tells you what styling was left behind.
- Whole folders to one zip, subfolders kept
- Files never leave your device
- Try 3 files free; $19 once for unlimited
Drop subtitle files or a folder hereChoose subtitle files
SRT, WebVTT, ASS/SSA, MicroDVD, YouTube .sbv and TTML/DFXP (.ttml .dfxp .xml); any number of files. On phones, select several files instead of a folder.
Options auto encoding, no offset, keep tags
Sample batch2 files
- survey-crew.ttmlReady, 1 warning
- Styling was dropped (colours, fonts); italic, bold and underline were kept.
- lecture-frames.dfxpReady, 1 warning
- 1 cue has no end or duration; it ends when the next cue starts (3 seconds for the last one).
1 00:00:01,250 --> 00:00:04,125 The survey crew arrived at <i>dawn</i>. 2 00:00:04,500 --> 00:00:07,000 Two engineers, one very old map. 3 00:00:08,200 --> 00:00:10,900 Rock & tide, as the log says.
Converted in this tab. Nothing is uploaded.
The format
TTML, DFXP and where you meet them
TTML (Timed Text Markup Language) is the W3C's XML format for captions. DFXP is the name of its first version, and the two are read the same way: both are an XML file whose root element is <tt>, with each caption in a <p> element that carries begin and end times. Older web players and caption tools exported DFXP, and the TTML profiles used in broadcast and streaming delivery, such as EBU-TT-D and SMPTE-TT, are built on the same markup.
Files arrive with .ttml, .dfxp or plain .xml extensions, so the converter decides by content: if the first element is <tt>, it is timed text. Other XML files are reported as not subtitles instead of being guessed at.
Real output
A real TTML file and the SRT it produces
The input uses ticks, a style reference, a duration instead of an end time, a line break and an escaped ampersand. The SRT below is what this converter writes for it.
Before: survey-crew.ttml
<?xml version="1.0" encoding="UTF-8"?>
<tt xmlns="http://www.w3.org/ns/ttml" xmlns:tts="http://www.w3.org/ns/ttml#styling" xmlns:ttp="http://www.w3.org/ns/ttml#parameter" xml:lang="en" ttp:tickRate="10000000">
<head>
<styling>
<style xml:id="emph" tts:fontStyle="italic"/>
<style xml:id="base" tts:color="white" tts:fontFamily="proportionalSansSerif"/>
</styling>
</head>
<body>
<div>
<p begin="12500000t" end="41250000t" style="base">The survey crew arrived at <span style="emph">dawn</span>.</p>
<p begin="45000000t" dur="2.5s" style="base">Two engineers,<br/>one very old map.</p>
<p begin="82000000t" end="109000000t">Rock & tide, as the log says.</p>
</div>
</body>
</tt>After: survey-crew.srt
1 00:00:01,250 --> 00:00:04,125 The survey crew arrived at <i>dawn</i>. 2 00:00:04,500 --> 00:00:07,000 Two engineers, one very old map. 3 00:00:08,200 --> 00:00:10,900 Rock & tide, as the log says.
What the converter reports for this file:
- Styling was dropped (colours, fonts); italic, bold and underline were kept.
Timing
The part that goes wrong: how TTML says "when"
A TTML time can be written four different ways, and a converter that only knows clock times will drop or misplace the rest.
| Written as | Meaning | Converted |
|---|---|---|
| 00:01:02.500 | Clock time with a fraction | Hours, minutes, seconds and the fraction, to the millisecond |
| 00:01:02:12 | Clock time with frames | Frames divided by the file's frame rate (ttp:frameRate, default 30; ttp:frameRateMultiplier such as 1000 1001 is applied) |
| 12.5s, 800ms, 2m, 1h | Offset time | Converted by unit |
| 125000000t | Ticks | Divided by ttp:tickRate; if the file does not set one, by the frame rate times the sub-frame rate, else 1 per second as the standard says |
| begin plus dur | No end time | End is begin plus dur; if both end and dur are given the earlier one wins |
| begin only | No end or dur | Ends when the next caption starts (3 seconds for the last one), with a warning |
| begin on a <div> or <body> | Children are relative to it | Added to the begin of every caption inside |
Text and styling
What happens to the words and the look
- <br/> becomes a line break inside the cue, and nested <span> elements are joined into one line of text.
- Italic, bold and underline are kept, whether set on the element itself (tts:fontStyle, tts:fontWeight, tts:textDecoration) or through a <style> it references.
- Colours, fonts, sizes, alignment, positions and regions are dropped, and one warning per file names what was left out.
- Entities such as & and < and numeric character references are turned back into characters; XML comments, CDATA and the head section are handled without leaking into the text.
- Word-by-word timed spans inside a caption are merged into the caption, with a warning that says so.
- A truncated or badly nested file is read as far as it goes and reported, never dropped without a message.
How to
How to convert TTML or DFXP to SRT
Drop the files or the folder
Drag .ttml, .dfxp or .xml files onto the converter, or a whole delivery folder. Other files are skipped.
Check the warnings
Each file shows its cue count and what the converter did: dropped styling, captions without an end time, anything it could not read.
Choose the output and save
SRT is selected here; WebVTT, ASS, MicroDVD and plain text are one click away. Several files come back as one zip with your folders kept.
FAQ
Questions
Is DFXP the same as TTML?
DFXP is the original name of the TTML format. The converter reads both, whatever the file extension is, including .xml files that start with a <tt> element.
Does it read frame-based and tick-based timing?
Yes. Frames use ttp:frameRate (30 if absent) and ttp:frameRateMultiplier, ticks use ttp:tickRate, and clock times, offset times such as 12.5s and parent begin offsets are supported as well.
Will I lose the colours and positions?
SRT cannot hold them, so they are dropped, and a warning names what was left out. Italic, bold and underline are kept. Keep the original TTML file if you still need the styling.
Can it convert SRT to TTML?
No. TTML and DFXP are input formats here. Captionry writes SRT, WebVTT, ASS, MicroDVD and plain text.
What about image-based or SMPTE time-code files?
Captions stored as embedded images are not text and cannot be converted. SMPTE time codes are read as plain hours:minutes:seconds:frames, and the file gets a warning saying so; drop-frame counting is not applied.
Can I convert a whole folder?
Yes. Free for 3 files per batch; Unlimited ($19 once) has no limit. Files are converted in your browser tab and never uploaded.
Related
More from Captionry
Converting more than 3 files at a time?
Unlimited removes the batch limit for $19 once, with no subscription.