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

Michael Mueck mick.mueck at mac.com
Sat Apr 30 19:05:40 EEST 2022


Hi again,

So I've had time to digest the inputs I've received so far and have my next question. Just to recap, I have a decrypted ripped DVD (just the main movie was extracted, no menus, no compression etc.) into a folder called "uncompressed.dvdmedia" that contains:
ls -R uncompressed.dvdmedia

AUDIO_TS	Info.json	VIDEO_TS

uncompressed.dvdmedia/AUDIO_TS:

uncompressed.dvdmedia/VIDEO_TS:
VIDEO_TS.IFO	VTS_01_0.IFO	VTS_01_1.VOB	VTS_01_2.VOB

 I converted uncompressed.dvdmedia to an MKV file named "uncompressed.mkv" using MakeMKV. Here is the relevant English subtitle stream info for that file, and note that stream also contains embedded tags for the parts that are forced subtitles:

ffmpeg -i uncompressed.mkv
...
  Stream #0:5(eng): Subtitle: dvd_subtitle, 720x480 (default)
    Metadata:
      BPS-eng         : 3503
      DURATION-eng    : 00:46:28.375077777
      NUMBER_OF_FRAMES-eng: 372
      NUMBER_OF_BYTES-eng: 1221288
      SOURCE_ID-eng   : 0120BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.16.7 darwin(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2022-04-28 03:45:22
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID

When I do the following command I end up with a movie that displays ONLY the forced English subtitles by default (which is exactly what I want):

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 copy -disposition:s:0 default \
-default_mode passthrough \
compressed.mkv

However, I don't want to have to first convert my movie to an MKV because that process is prone to introducing A/V sync issues. I was instructed by Nicolas George to use dvd2concat and then operate on that output. So here's what I did:

dvd2concat uncompressed.dvdmedia > file.concat

Here's the streams that contains:
ffmpeg -analyzeduration 500M -probesize 500M -safe 0 -f concat -protocol_whitelist concat,ffconcat,file,subfile -i file.concat
...
  Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, progressive), 720x480 [SAR 32:27 DAR 16:9], 29.50 fps, 59.94 tbr, 90k tbn
    Side data:
      cpb: bitrate max/min/avg: 7600000/0/0 buffer size: 1835008 vbv_delay: N/A
  Stream #0:1(en): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
  Stream #0:2(fr): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
  Stream #0:3(pt): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
  Stream #0:4(en): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:5(en): Subtitle: dvd_subtitle, 720x480
  Stream #0:6(en): Subtitle: dvd_subtitle, 720x480
  Stream #0:7(fr): Subtitle: dvd_subtitle, 720x480
  Stream #0:8(pt): Subtitle: dvd_subtitle, 720x480
  Stream #0:9(es): Subtitle: dvd_subtitle, 720x480
  Stream #0:10(en): Subtitle: dvd_subtitle, 720x480
  Stream #0:11(pt): Subtitle: dvd_subtitle, 720x480
  Stream #0:12(es): Subtitle: dvd_subtitle, 720x480

I have confirmed stream 0:5 is still the correct English subtitle track, so I then did:

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!

Regards,

Mick



More information about the ffmpeg-user mailing list