Create SRT Subtitles From MKV Files

From MythTV Official Wiki
Revision as of 22:51, 17 October 2011 by Wagnerrp (talk | contribs) (mark as outdated)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Time.png Outdated: This task no longer necessary. SRT subtitles embedded into Matroska containers have been supported by the internal player since the 0.24 release

Based on a question from a user trying to use the internal MythTV player is display subtitles embedded in MKV files, [[1]] suggests the following workaround to extract SRT subtitles from MKV files.

$ mkvinfo film.mkv | grep subtitles -B3
| + A track
| + Track number: 3
| + Track UID: 2131733228
| + Track type: subtitles
$ mkvextract tracks film.mkv

This is necessary because there is no support in MythTV's internal player for embedded subtitles. If you have a number of files in a directory that share the same track number for their subtitles (track 3 in the previous and following examples), you can avoid having to mkvextract each line by using the following bash loop.

for file in *.mkv; 
  mkvextract tracks "$file" 3:"${file/mkv/srt}"; 

The package that contains mkvinfo and mkvextract is 'mkvtoolnix' in Ubuntu.