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

Michael Mueck mick.mueck at mac.com
Sun May 1 00:28:40 EEST 2022


> dvd2concat uncompressed.dvdmedia > file.concat

> ffmpeg -analyzeduration 500M -probesize 500M -forced_subs_only 1 \
> -safe 0 -f concat -protocol_whitelist concat,ffconcat,file,subfile -i file.concat \
> -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 copy -disposition:s:0 default \
> -default_mode passthrough \
> compressed.mkv
> 
> However, when I play that compressed.mkv movie I see English subtitles for EVERYTHING and not for only the forced parts i.e. when only a foreign language is being spoken.
> 
> Could somebody please help me doing this last part so that my final subtitle track only contains the forced subtitles like it does when I start with an MKV instead. Thanks!

I think I found a solution through dumb luck while awaiting a response. I had previously been using the dvdsub codec and was told to use the "copy" codec instead, so I switched everything over to that. Later, when the dvd2concat technique was proposed, I ended up with the above commands, but that still didn't work - the final mkv file had English subtitles for everything instead of just the desired forced subtitles.

On a whim, I thought I'd try using the "dvdsub" subtitle codec again i.e. these commands:

dvd2concat uncompressed.dvdmedia > file.concat

ffmpeg -analyzeduration 500M -probesize 500M -forced_subs_only 1 \
-safe 0 -f concat -protocol_whitelist concat,ffconcat,file,subfile -i file.concat \
-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 \
compressed.mkv

and this time my final subtitle track was only the forced subtitles!! I'm so happy :-). It looks like if you use the dvd2concat method you must the dvdsub codec if you want "-forced_subs_only 1" to work.

There is also apparently an error in my earlier posts. I could have sworn when I switched everything over to the subtitle "copy" codec that I confirmed I still got only the forced subtitles with an MKV input, but I just checked again and that's not so. It looks like the only way to get just the forced subtitles via "-forced_subs_only 1" with an MKV input is by using the dvdsub codec. 

Regards,

Mick



More information about the ffmpeg-user mailing list