All I wanted to do was shift the timing of the subtitles of a dvd by a little. They drift, and by the end of a ~2 hour movie, they're off by more than 2 seconds. (It's probably that PAL/NTSC frames per second thing; I dunno.)
In the past, it's been possible to use mkvtoolnix-gui to extract the subtitle track to a separate file, and then use subtitleeditor to time scale the dialog.
The output of ffmpeg -in in1.mkv shows the subtitle track clearly.
$ time ffmpeg -i in1.mkv
Input #0, matroska,webm, from 'in1.mkv':
Metadata:
creation_time : 2015-06-24T21:27:55.000000Z
ENCODER : Lavf63.1.83
Duration: 01:58:23.66, start: 0.000000, bitrate: 1225 kb/s
Stream #0:0: Video: h264 (High), yuv420p(tv, smpte170m, progressive), 720x480 [SAR 32:27 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn (default)
Metadata:
DURATION : 01:57:33.936000000
Stream #0:1(eng): Audio: aac (LC), 48000 Hz, 5.1, fltp (default)
Metadata:
title : Surround 5.1
DURATION : 01:57:33.936000000
Stream #0:2(eng): Audio: aac (LC), 48000 Hz, stereo, fltp
Metadata:
DURATION : 01:57:33.936000000
Stream #0:3(eng): Subtitle: dvd_subtitle (dvdsub), 720x480
Metadata:
DURATION : 01:57:33.936000000
At least one output file must be specified
So why didn't this work?
ffmpeg -i in1.mkv -c:s dvdsub -an -vn out1.srt
It's because dvdsub is an image stream for subtitles, and not text. So I had to use some ocr, from package subtile-ocr [sic]. My process used:
mkvextract tracks in1.mkv 3:english.sub
subtile-ocr --lang eng english.sub --output english2.srt
And then subtitleeditor to scale the timing, and then mkvtoolnix-gui to re-mux it together. I'm sure it could be done with cli, but I already know how to click-and-drag in mkvtoolnix-gui quickly.
All this because I like to read my movies.
Summary of packages used
- subtile-ocr (which needs various tesseract things, probably. I already had tesseract)
- mkvtoolnix
- mkvtoolnix-gui
- subtitleeditor
- ffmpeg (not necessary for vobsub to srt)
References
subtile-ocr --help
- duck.ai to tell me vobsub is not text.
- school of hard knocks