[FFmpeg-user] Using *.SUP (subpicture) files with ffmpeg

Dan Hentschel dan at hentschels.com
Fri Jan 18 19:53:36 CET 2013


I am currently in the process of ripping my HD-DVD collection and shrinking
down the ~15-20GB files to a more manageable 3-4GB. Since my wife is deaf,
I definitely want to keep the subtitles on each film.

To accomplish this, I am using a combination of eac3to, ffmpeg, and
mkvmerge. The procedure I use depends on the content of the ripped *.evo
file. Here are a couple of examples.

2 Fast 2 Furious.evo:

Ffmpeg is able to detect a subtitle stream in this file:

$ ffprobe file:"2 Fast 2 Furious.evo"
ffprobe version N-37336-gd0c27e8 Copyright (c) 2000-2012 the FFmpeg
developers
  built on Oct 18 2012 13:32:14 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libfaac --enable-libfdk-aac
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx
--enable-x11grab --enable-libx264 --enable-nonfree --enable-version3
  libavutil      51. 76.100 / 51. 76.100
  libavcodec     54. 66.100 / 54. 66.100
  libavformat    54. 33.100 / 54. 33.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 19.103 /  3. 19.103
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 16.100 /  0. 16.100
  libpostproc    52.  1.100 / 52.  1.100
[mpeg @ 0xa461540] Stream #5: not enough frames to estimate rate; consider
increasing probesize
Input #0, mpeg, from 'file:2 Fast 2 Furious.evo':
  Duration: 01:47:41.92, start: 0.030556, bitrate: 22657 kb/s
    Stream #0:0[0xfd55]: Video: vc1 (Advanced), yuv420p, 1920x1080 [SAR 1:1
DAR 16:9], 28.17 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0xc3]: Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s
    Stream #0:2[0xc2]: Audio: eac3, 48000 Hz, 5.1(side), s16, 384 kb/s
    Stream #0:3[0xc1]: Audio: eac3, 48000 Hz, 5.1(side), s16, 384 kb/s
    Stream #0:4[0xc0]: Audio: eac3, 48000 Hz, 5.1(side), s16, 1536 kb/s
    Stream #0:5[0x20]: Subtitle: dvd_subtitle

This makes things easy:

$ nice -n 19 ffmpeg -i 'file:2 Fast 2 Furious.evo' -an -sn -vcodec libx264
-r 24000/1001 -tune film -preset medium -b:v 3600k -threads 3 -pass 1 -f
mp4 -y /dev/null && nice -n 19 ffmpeg -i 'file:2 Fast 2 Furious.evo' -map
0:0 -map 0:4 -map 0:5 -acodec copy -scodec copy -vcodec libx264 -r
24000/1001 -tune film -preset medium -b:v 3600k -threads 3 -pass 2 "2 Fast
2 Furious.mkv"

This one command creates a single mkv file with everything I want in it. It
looks nice, it plays well, the subtitles are beautiful. Everything is happy.


Scanner Darkly, A.evo:

For this one, ffmpeg doesn't detect any subtitle stream:

$ ffprobe file:"Scanner Darkly, A.evo"
ffprobe version N-37336-gd0c27e8 Copyright (c) 2000-2012 the FFmpeg
developers
  built on Oct 18 2012 13:32:14 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libfaac --enable-libfdk-aac
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx
--enable-x11grab --enable-libx264 --enable-nonfree --enable-version3
  libavutil      51. 76.100 / 51. 76.100
  libavcodec     54. 66.100 / 54. 66.100
  libavformat    54. 33.100 / 54. 33.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 19.103 /  3. 19.103
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 16.100 /  0. 16.100
  libpostproc    52.  1.100 / 52.  1.100
[mpeg @ 0x9a04540] max_analyze_duration 5000000 reached at 5004667
Input #0, mpeg, from 'file:Scanner Darkly, A.evo':
  Duration: 01:40:23.00, start: 0.038011, bitrate: 16352 kb/s
    Stream #0:0[0xfd55]: Video: vc1 (Advanced), yuv420p, 1920x1080 [SAR 1:1
DAR 16:9], 30.50 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0xc1]: Audio: eac3, 48000 Hz, stereo, s16, 192 kb/s
    Stream #0:2[0xc0]: Audio: eac3, 48000 Hz, 5.1(side), s16, 640 kb/s

However, I am able to use eac3to to demux the evo and pull out the subtitle
stream as a *.SUP file. I can then use ffmpeg to handle the audio and video:

$ nice -n 19 ffmpeg -i 'file:Scanner Darkly, A.evo' -an -vcodec libx264 -r
24000/1001 -tune film -preset medium -b:v 3600k -threads 3 -pass 1 -f mp4
-y /dev/null && nice -n 19 ffmpeg -i 'file:Scanner Darkly, A.evo' -map 0:0
-map 0:2 -acodec copy -scodec copy -vcodec libx264 -r 24000/1001 -tune film
-preset medium -b:v 3600k -threads 3 -pass 2 interim.mkv

At this point, though, ffmpeg refuses to push the subpicture file into the
MKV:

$
ffmpeg -i interim.mkv -i file:"Scanner Darkly, A.sup" -acodec copy -vcodec
copy -scodec copy "Scanner Darkly, A.mkv"
ffmpeg version N-37336-gd0c27e8 Copyright (c) 2000-2012 the FFmpeg
developers
  built on Oct 18 2012 13:32:14 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libfaac --enable-libfdk-aac
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx
--enable-x11grab --enable-libx264 --enable-nonfree --enable-version3
  libavutil      51. 76.100 / 51. 76.100
  libavcodec     54. 66.100 / 54. 66.100
  libavformat    54. 33.100 / 54. 33.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 19.103 /  3. 19.103
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 16.100 /  0. 16.100
  libpostproc    52.  1.100 / 52.  1.100
Input #0, matroska,webm, from 'tmp.mkv':
  Metadata:
    creation_time   : 2013-01-16 17:36:36
    ENCODER         : Lavf54.33.100
  Duration: 01:40:23.02, start: 0.000000, bitrate: 4241 kb/s
    Stream #0:0: Video: h264 (High), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9],
23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1: Audio: eac3, 48000 Hz, 5.1(side), s16, 640 kb/s (default)
file:Scanner Darkly, A.sup: Invalid data found when processing input

I also can't get mkvmerge to do anything with it:

$ mkvmerge -S interim.mkv "Scanner Darkly, A.sup" -o "Scanner Darkly, A.mkv"
mkvmerge v5.1.0 ('And so it goes') built on Feb  1 2012 11:31:23
Error: The file 'Scanner Darkly, A.sup' is a non-supported file type
(HD-DVD sub).

So what I've been doing is to use a program called SUPRip to OCR the *.sup
files into an SRT (subrip) format. Once I have this, both ffmpeg and
mkvmerge will happily slap it into my audio/video stream. This is workable,
but the OCR process needs hand-holding, and inevitably makes some mistakes
in the resulting file. It's nowhere near as nice or as easy as converting
the files where ffmpeg can simply detect the subtitle to begin with.

So, my question is, is there some way to get ffmpeg to either notice the
subtitles that it is not noticing, or to ingest the *.sup files that are
coming out of eac3to?

 - dan

-- 
dan B hentschel
dan at hentschels.com


More information about the ffmpeg-user mailing list