alfter.us - Scott's Blog | Things that interest me

Example domain paragraphs

I recently had some need to clean up the subtitles in some video files in my possession. It took a little while to track down the exact set of options to get it to do what I wanted it to do, so I’ve written them down here for future reference. This post may be amended from time to time to add more

The second number in the -map parameter selects the (zero-indexed) stream to extract. Use something like mediainfo to determine which stream to select, then issue something like this:

ffmpeg -i src.m4v -c copy -map 0:2 dest.en.sub.mkv The subpicture stream will be in a Matroska container…perhaps the tools in mkvtoolnix can demux it if you need raw subpictures. Subtitle Edit can read subpictures in .mkv files and convert them to text subtitles. As long as you have a .NET runtime available, it should work; I’ve run it on Windows 11 and Gentoo Linux. Its accuracy is pretty good, especially if you have it use one of the Tesseract OCR engines.

Links to alfter.us (3)