How to extract subtitles from Video files

command linevideo-subtitles

I want to use the command line to extract subtitles from video files.

I want to extract subtitles from a lot of files. That is why I want a CLI tool.

Ideally it should work with any video format that supports embedded subtitles.

For example:

subextract -f RevolutionOS.mp4

Extracting English.srt
Extracting French.srt
Extracting Russina.srt
All subtitles extracted

Best Answer

There are such tools, specific to each container type (assuming subtitles are stored as text, not mixed in the video stream):

For your question specifically, the command line would be

MP4Box -srt <trackID> RevolutionOS.mp4

Where possible values of trackID can be deduced from the output of

MP4Box -info RevolutionOS.mp4

For subtitles which are mixed into the video stream (so-called hardsubs), OCR software is required. There seem to be ready-made solutions here, for example subtitleripper + GOCR for VobSub (common format for DVD), but I have no experience with those and no idea how good they are.

Related Question