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

Michael Mueck mick.mueck at mac.com
Fri Apr 29 04:18:10 EEST 2022


G'day Ferdi,

I added the analyzeduration and probesize options as you suggested (which added about 3.5 minutes to the total time for a 48 minute TV episode before encoding started) but it didn't change anything. Note that I also had changed the subtitle codec from dvdsub to copy. That's not to say it wouldn't have worked, because there is a strange issue. Since changing the subtitle codec from dvdsub to copy I went from getting an empty subtitle track to now getting the wrong subtitle track in the output. I mapped stream 6 (the regular English subtitle track that also contains the tagged forced subtitles) but instead I am getting stream 7 (the English SDH subtitle track). Stream 7 very likely won't have any tagged forced subtitles in it (in which case you'd think you'd end up with an empty track given the "-forced_subs_only 1" specification.

This is the command and the output I see at the terminal (with a couple comments that I added):

ffmpeg -forced_subs_only 1 -analyzeduration 10000000M -probesize 10000000M \
-i combined.VOB \
-vsync cfr \
-map 0:1 -c:v hevc_videotoolbox -b:v 1500k -color_primaries:v smpte170m -color_trc:v bt709 -colorspace:v smpte170m -metadata:s:v title\= -disposition:v default \
-map 0:2 -c:a:0 copy -metadata:s:a:0 title\= -disposition:a:0 default \
-map 0:6 -c:s:0 copy -disposition:s:0 default \
-metadata:g title\= -default_mode passthrough \
-y crap.mkv



Input #0, mpeg, from 'combined.VOB':
  Duration: 00:48:19.62, start: 0.280633, bitrate: 5575 kb/s
  Stream #0:0[0x1bf]: Data: dvd_nav_packet
  Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, progressive), 720x480 [SAR 32:27 DAR 16:9], 5000 kb/s, 29.97 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:2[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
  Stream #0:3[0x81]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
  Stream #0:4[0x82]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
  Stream #0:5[0x83]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:6[0x21]: Subtitle: dvd_subtitle    ----> (This is the regular English subtitle track that also contains the tagged forced subtitles)
  Stream #0:7[0x25]: Subtitle: dvd_subtitle    ----> (This is the SDH subtitle track)
  Stream #0:8[0x26]: Subtitle: dvd_subtitle
  Stream #0:9[0x27]: Subtitle: dvd_subtitle
  Stream #0:10[0x20]: Subtitle: dvd_subtitle
  Stream #0:11[0x22]: Subtitle: dvd_subtitle
  Stream #0:12[0x23]: Subtitle: dvd_subtitle
  Stream #0:13[0x24]: Subtitle: dvd_subtitle
Stream mapping:
  Stream #0:1 -> #0:0 (mpeg2video (native) -> hevc (hevc_videotoolbox))
  Stream #0:2 -> #0:1 (copy)
  Stream #0:6 -> #0:2 (copy)
Press [q] to stop, [?] for help
Output #0, matroska, to 'crap.mkv':
  Metadata:
    encoder         : Lavf59.16.100
  Stream #0:0: Video: hevc, yuv420p(tv, smpte170m/smpte170m/bt709, progressive), 720x480 [SAR 32:27 DAR 16:9], q=2-31, 1500 kb/s, 29.97 fps, 1k tbn (default)
    Metadata:
      encoder         : Lavc59.18.100 hevc_videotoolbox
  Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
  Stream #0:2: Subtitle: dvd_subtitle ([255][255][255][255] / 0xFFFFFFFF) (default)
More than 1000 frames duplicated   37888kB time=00:02:44.03 bitrate=1892.2kbits/s dup=985 drop=0 speed=13.6x    
More than 10000 frames duplicated 395264kB time=00:27:42.04 bitrate=1948.2kbits/s dup=9963 drop=0 speed=13.8x    
frame=86902 fps=415 q=-0.0 Lsize=  690877kB time=00:48:19.59 bitrate=1951.9kbits/s dup=17382 drop=0 speed=13.8x    
video:529401kB audio:158534kB subtitle:1427kB other streams:0kB global headers:0kB muxing overhead: 0.219704%


Regards,

Mick


> On 2022.0428, at 17:50, Ferdi Scholten via ffmpeg-user <ffmpeg-user at ffmpeg.org> wrote:
> 
> 
>> Anybody know what's going on here? How come ffmpeg respects "-forced_subs_only 1" for an MKV but not for a VOB?
>> 
>> 
>> 
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>> 
>> To unsubscribe, visit link above, or email
>> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
> In the VOB structure the subtitle track may begin at the first time where it is needed. When you only have the VOB files, the forced subtitles might not be at the beginning of the structure so will not be found by ffmpeg when it analyzes the first 5 seconds (default) of the VOB file. You can force ffmpeg to analyze a bigger part of the VOB file to find additional streams by adding -analyzeduration and -probesize in your command. Both default to 5000000 meaning it wil scan the first 5000000 microseconds of the first 5000000 bytes of the file. Specify large values here to analyze a much bigger part of the file for a longer duration.
> for example:
> 
> ffmpeg -analyzeduration 10000000M \
> -probesize 10000000M \
> -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 \
> compressed.mkv
> 
> 
> Greetings
> Ferdi Scholten
> 
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-user mailing list