Ttml2srt
Convert TTML subtitles used by Netflix, HBO, CMore and others to SRT format
Install / Use
/learn @yuppity/Ttml2srtREADME
ttml2srt
Convert TTML subtitles used by Netflix, HBO, CMore and others to SRT format.
Note: ttml2srt is not a full-featured TTML-to-SRT converter and only works on a small subset of TTML documents. Namely, documents that follow the formats seen on the aforementioned streaming services.
Usage
positional arguments:
ttml-file TTML subtitle file
output-file file to write resulting SRT to
optional arguments:
-h, --help show this help message and exit
-s [ms], --shift [ms]
shift
-f [fps], --fps [fps]
frames per second (default: 23.976)
--t-dur [sec] target duration
--s-dur [sec] source duration
Common use cases
Simple conversion:
./ttml2srt.py subtitle_from_netflix.xml > subtitle.srt
or
./ttml2srt.py subtitle_from_netflix.xml subtitle.srt
Shift everything forward by 2 secs:
./ttml2srt.py -s 2000 subtitle_from_netflix.xml > subtitle.srt
Convert with specific frame rate (only has an effect when input timestamps have frames):
./ttml2srt.py -f 25 subtitle_from_hbo_nordic.xml > subtitle.srt
You'll probably run into a situation where your target is playing at either slower or faster speed compared to a streaming service. You can scale timestamps to fit a source to a target by picking the same frame from both the target and source and comparing the timestamp.
Here's an example cmd for when the first piece of dialogue from a streaming service is starting two seconds behind the target audio and where a frame towards the end has a timestamp of 00:15:39 (939s) in the target and 00:16:23 (983s) in the source:
./ttml2srt.py -s -2000 --t-dur 939 --s-dur 983 subtitle.xml
Run tests:
python3 tests/test01.py
Related Skills
node-connect
342.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
claude-opus-4-5-migration
85.3kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
85.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
model-usage
342.5kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
