Converting DVD subtitles to text

I want to convert image-based subtitles (dvd_subtitle) to text-based subtitles (mov_text). I'm on OS X and would strongly prefer to use a free command-line based tool.

My source data is either a DVD image (.iso/.dmg file containing a VIDEO_TS folder) or an already converted MP4 file containing a vobsub subtitle stream.

I found the promising vobsub2srt and this great article on subtitle conversion, but I can't figure out how to get the .sub/.idx files from my .dmg or .mp4 file.

I've tried various options with ffmpeg with no success. I also tried googling the topic, but was surprised to find no immediate solutions.

So how do I extract .sub/.idx files from a .dmg/.mp4 file? (Or more generically, how do I generate text-based subtitles from a .dmg/.mp4 file containing image-based subtitles?)

The DVD is a standard DVD image with VIDEO_TS file. The mp4 file looks like this:

Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/bt709), 700x572 [SAR 16:15 DAR 560:429], 898 kb/s, 25 fps, 25 tbr, 90k tbn, 180k tbc (default)
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 159 kb/s (default)
Stream #0:2(eng): Subtitle: dvd_subtitle (mp4s / 0x7334706D), 720x576, 5 kb/s (default)

Solution 1:

To extract subtitles from an IFO file, you need a tool like Avidemux. This tool is available for mac users too. (I myself use MeGUI, but it's only for windows).You can find a tutorial here, how to do it on Avidemux.

To convert .sub/.idx subtitles to srt or other text formats:
For windows users there is a free tool called VobSub. You can check a tutorial how to do it here. Since you are on a MAC, check BDSup2Sub. The way you have to use the tool is almost the same as VobSub. Additionally you can use Avidemux to convert to srt too, since it has an OCR option (the tutorial about avidemux above, shows this step too).