[FFmpeg-user] Extracting forced subtitles from a DVD.

Michael Mueck mick.mueck at mac.com
Thu Apr 28 20:40:24 EEST 2022


First time poster here - please be gentle on me :-).

I have decrypted and ripped all of my DVDs into individual VIDEO_TS structures for just the main movie or an individual TV episode. Each move or TV episode consists of a VIDEO_TS folder containing the original uncompressed
	VIDEO_TS.IFO,  VTS_01_0.IFO  and  VTS_01_[1->N].VOB  files.

The time has finally come for me to COMPRESS everything into MKV files and I want to do that using a script calling ffmpeg. My intention is to toss all audio streams except English 5.1 (where possible) and only keep one subtitle track containing forced English subtitles IF forced subtitles exist. However, dealing with forced subtitles has proven to be too much for me :-(. 

I know that forced English subtitles can be authored a couple different ways - either as a separate subtitle track or as part of the regular English subtitle track in which the forced bits are tagged so they can be identified and displayed separately if requested. Irrespective of which technique is employed, my DVD player always just works when displaying only forced subtitles. Likewise, Apple's DVD Player app also just works (although it won't play MKV files). Annoyingly, I haven't found ANY other playing software that will reliably play my ripped movies/episodes and only display forced subtitles as needed (i.e. AUTOMATICALLY select the right forced subtitle track or AUTOMATICALLY only display the forced subtitles within the English subtitle track). 

I'd like to start with movies containing forced subtitles are not in their own subtitle track but rather tagged within the regular English subtitle track. 

Here's something that works. Using MakeMKV, I first convert the VIDEO_TS structure into an MKV file called "uncompressed.mkv". I don't know yet how to instruct ffmpeg to specifically pick out only the subtitle track containing the embedded forced subtitles, so for now I'll pick it manually and run the following ffmpeg command (notably utilizing the "-forced_subs_only 1" option and the "dvdsub" codec:

ffmpeg -forced_subs_only 1 \
-i uncompressed.mkv \
-vsync cfr \
-map 0:0 -c:v hevc_videotoolbox -disposition:v default \
-map 0:1 -c:a:0 copy -disposition:a:0 default \
-map 0:5 -c:s:0 dvdsub -disposition:s:0 default \
-default_mode passthrough \

That works i.e. when I play "compressed.mkv" I only see English subtitles when the non-English stuff is spoken :-).

However, for reliability reasons I'd like to avoid for now, I don't want to first convert my movie to MKV i.e. I'd like to have ffmpeg directly operate on the original VOB structure. I understand that (to my IMMENSE displeasure) in 2022 FFmpeg is unable to treat a DVD structure as a single movie - it can only deal with ONE VOB file. So I did:
	cat *.VOB > combined.vob
and used that as the input to the same ffmpeg command i.e.:
(Please ignore the different stream numbers - MakeMKV removes the VOB's stream 0:0 <dvd_nav_packet> and subtracts 1 from each of them)

ffmpeg -forced_subs_only 1 \
-i combined.vob \
-vsync cfr \
-map 0:1 -c:v hevc_videotoolbox -disposition:v default \
-map 0:2 -c:a:0 copy -disposition:a:0 default \
-map 0:6 -c:s:0 dvdsub -disposition:s:0 default \
-default_mode passthrough \

That did NOT work because the resultant subtitle track was completely empty! I also tried another trick for defining the ffmpeg input using:
	-i concat:"$(ls -1 VIDEO_TS/*.VOB | sort | xargs echo | sed 's/ /|/g')"
but it still yielded an empty subtitle track. Same thing when I also tried:
	cat VTS_01_0.IFO *.VOB > combined.vob

I've been able to confirm the VOB files contain all of the subtitles, and that VIDEO_TS.IFO is irrelevant, but I haven't been able to prove if VTS_01_0.IFO contains the tags for the specific forced subtitles (I suspect not, but I don't know).

Anybody know what's going on here? How come ffmpeg respects "-forced_subs_only 1" for an MKV but not for a VOB?

Sorry for the lengthy email - if you've made it this far I'm already thankful!



More information about the ffmpeg-user mailing list