Convert subtitles from the command line with SubtitleEdit

We can use SubtitleEdit from the command line in Windows to do batch operations on subtitle files.

Just install SubtitleEdit first. If you are using the portable version, make sure you put the exe in PATH.

Example:

Convert TTML to SRT:

SubtitleEdit /convert subtitle.ttml subrip

It’s even easier in a Directory Opus button. Just make sure it is set to run as MS-DOS Batch function:

SubtitleEdit /convert {file$} subrip

Output:

<?xml version="1.0" encoding="UTF-8"?><tt xml:lang="en" xmlns="http://www.w3.org/ns/ttml" xmlns:tts="http://www.w3.org/ns/ttml#styling">
  <head>
    <styling>
      <style xml:id="italic" tts:fontStyle="italic" />
      <style xml:id="left" tts:textAlign="left" />
      <style xml:id="center" tts:textAlign="center" />
      <style xml:id="right" tts:textAlign="right" />
    </styling>
  </head>
  <body>
    <div>
      <p begin="00:00:00.000" dur="00:00:00.000">Lorem ipsum</p>
      <p begin="00:00:51.040" dur="00:00:02.400" style="left">(dolor)</p>
      <p begin="00:01:29.000" dur="00:00:03.460" style="left">-abc? Abc!<br />-Hello world</p>
      <p begin="00:01:32.760" dur="00:00:03.280" style="left">abcabc<br />-Ok.</p>

Becomes this:

1
00:00:00,000 --> 00:00:00,000
Lorem ipsum

2
00:00:51,040 --> 00:00:53,440
(dolor)

3
00:01:29,000 --> 00:01:32,460
-abc? Abc!
-Hello World

4
00:01:32,760 --> 00:01:36,040
-Nå må du komme og spise.

Leave a Reply

Your email address will not be published. Required fields are marked *