How do I extract subtitles from Video files?
There are such tools, specific to each container type (assuming subtitles are stored as text, not mixed in the video stream):
- MKV:
mkvtoolnix
- MP4 and 3GP:
MP4Box
- AVI:
ffmpeg
/avconv
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 videos on Youtube
![Wally](https://i.stack.imgur.com/Vtgjv.png?s=256&g=1)
Wally
Updated on September 18, 2022Comments
-
Wally almost 2 years
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
-
Wally about 8 years@terdon Have updated the question. I mean embeeded subtitles. Not Hardcoded ones.
-
terdon about 8 yearsIs there any difference between embedded and hardcoded? Are you sure this is even possible?
-
Alessio about 8 yearsI would imagine that hard-coded subtitles are edited onto the video itself with the text overlaid on top of the video, while embedded subtitles are text files (in one of the common subtitle formats) embedded in the container file (.mp4, .mkv, etc). Extracting the embedded subtitles should be possible - every video player that supports subtitles manages to do it in order to display them. googling
extract subtitle from container
gets about 350,000 results including superuser.com/questions/391892/extract-subtitles-from-movie which mentions gpac.wp.mines-telecom.fr/mp4box -
Alessio about 8 years(if anyone wants to "steal" my comment and turn it into a real answer, i'll happily upvote it. don't have time myself, or enough interest/knowledge in the subject. anyway, comments are always fair game for stealing into answers).
-