Useful Mac/Linux Commands to Extract, Convert, etc. Subtitles

Here’s a bunch of useful commands I use for extracting, converting subtitles from mostly mkv and mp4 files with mostly SubRip/SRT and VTT formatting.

I use these on both macOS and Linux (Ubuntu).

Subtitle Commands

Extracting subtitles from mp4 files

Check subtitle track ID with:

MP4Box -info video.mp4

Then extract SRT subtitles with (where number is the track ID):

MP4Box -srt 3 video.mp4

Extracting subtitles from mkv files

Check the subtitle track ID with:

mkvmerge -i video.mkv

Or get a verbose JSON output to for track language:

mkvmerge -i -J video.mkv

Extract with (where number is the track ID):

mkvextract tracks video.mkv 3:subtitle.srt

Convert SRT to VTT

ffmpeg -i subtitle.srt subtitle.vtt

To be continued..

Leave a Comment