Zones

Monday, May 5, 2014

Convert a MKS file to SRT in Ubuntu

In windows I have been using the great SubtitleEdit to do this task.
It runs well (with some small display glitches) under wine, although I only opened the subtitle without the video.

Recently I found a native, faster way to convert these files using mkvextract

First you have to identify the track you want to extract.
You can use the mkvmerge tool for this:

mkvmerge -i "filename.mkv" or
mkvmerge -i "filename.mks" (for subtile only files)

The output for a mkv file will look similar to the example below:

Track ID 0: video (MPEG-4p10/AVC/h.264)
Track ID 1: audio (DTS)
Track ID 2: subtitles (SubRip/SRT)
Track ID 3: subtitles (SubRip/SRT)
Chapters: 32 entries 

Form the output of the command you need to identify the Track ID of target subtitle track you wish to extract.

If you already have the MKS file use the following command to convert to SRT:

mkvextract tracks "filename.mks" 0:filename.srt

0 is the target subtitle track of the MKS file.

If you want to extract and convert one or more subtitle tracks directly form the MKV file you can use a command similar to the following:

mkvextract tracks "filename.mkv" 2:sub1filename.srt 5:sub2filename.srt

where 2 and 5 are the target subtitle tracks.

There is one more important aspect to note:
Only subtitle tracks of the type S-TEXT/UTF8 will be written as SRT files. The output file type is dependent on the track file type as stated in the mkvextract man page (link above).

The mkvmerge and mkvextract tools are part of the mkvtoolnix package which can be installed from the Ubuntu repositories.




11 comments:

  1. I use iDealshare VideoGo to extract srt subtitles from MKV, VOB, AVI, TS, MP4, FLV, WMV, MPG etc

    Step by step guide at http://www.idealshare.net/video-converter/extract-subtitles-from-mkv-vob-avi-mp4.html

    It also helps to add subtitles to video, remove or delete subtitles from video, or rotate, trim, crop, effect, watermark etc.

    ReplyDelete
  2. Its a great pleasure reading your post.Its full of information I am looking for and I love to post a comment that "The content of your post is awesome" Great work. Website

    ReplyDelete

Leave a comment or a question here. Please be polite.