Skip to content
This repository has been archived by the owner on Jun 5, 2018. It is now read-only.

TTML2SRT Subtitle Format Converter

xubuntu4iran edited this page Nov 26, 2016 · 6 revisions

TTML2SRT is a small program written in C++ that converts movie subtitles file format from TTML (Timed Text Markup Language, a format used on video sharing websites and W3C standard (extension .xml, .ttml)) to SRT (SubRip, commonly used subtitle format (extension .srt, .txt)).

Compilation

To compile the program using GNU G++ run the following command: g++ -o TTML2SRT TTML2SRT.cpp

Installation (completely optional)

If you want to add this program as system command (in UNIX-like OS-es), either do (as root): cp TTML2SRT /usr/bin or create a shell alias.

Usage

./TTML2SRT input.xml output.srt where:

  • input is the input file name
  • output is the output file name

Features

  • Verbosity - TTML2SRT outputs almost every parse action that takes place, so that you can easily debug them.
  • Simplicity - It is not any advanced converter, it takes only the subtitles without any formatting or additional information from TTML (in SRT I do not know any formatting anyway). It even strips formatting information from subtitle lines producing a clear output.
  • Not really tested - I used it to convert one TTML file so far, well, worked quite well but the produced subtitles were not always timed and two lines had not shown up (do not know if it is my code, subtitles or the player I used, I suppose there were errors in this file but I had written TTML2SRT in such a way that it can handle them).
  • Some error-repairing - As I mentioned above, TTML2SRT can even parse files with format errors and I mean here especially time format (errors like missing zeroes or miliseconds). It also converts time format to SRT and adds additional zeroes.

#Download page: You can download it's code from here: https://github.com/Phitherek/various/tree/cpp

Help

If you need additional help or want to report an issue, contact me at phitherek[at]gmail[dot]com or use GitHub' s Issue system.

Clone this wiki locally