Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to extract subtitles from MP4 and MKV movies. I'm using mp4box (on OS X) but cannot figure out how it works.

Any hints?

share|improve this question

1 Answer 1

up vote 17 down vote accepted

MP4 and 3GP files

The free and cross-platform MP4Box only works with MP4 or 3GP containers. You can install it from the homepage. First, you want look at the different tracks and see which ID belongs to the subtitle track.

MP4Box -info input.mp4

Look at the ID next to the subtitle track. Then, based on the track ID <trackId> you want to extract, call the following command:

MP4Box -raw <trackID> input.mp4

Or, to export to the commonly used SRT format:

MP4Box -srt <trackID> input.mp4

MKV files

In order to extract subtitles from Matroska (MKV) files, you need the free and open source mkvtoolnix packages. They come for Windows and Linux, and on a Mac you can install them through Homebrew with brew install mkvtoolnix.

Then, inspect the file:

mkvmerge -i input.mkv

This will list the tracks, for example like this:

File 'input.mkv': container: Matroska
Track ID 1: video (V_MPEG4/ISO/AVC)
Track ID 2: audio (A_AAC)
Track ID 3: subtitles (S_TEXT/UTF8)

Based on the ID of the track, call the following command, where <trackID> is the one you identified above. <output> is just a dummy name, you can use any you want.

mkvextract tracks input.mkv <trackID>:<output>.srt

So, in our case, that would have been:

mkvextract tracks input.mkv 3:subs.srt
share|improve this answer
    
This all works for linux too. I found MP4Box in the gpac package available via apt-get –  aidan Jun 12 at 14:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.