6

How can I extract dvd_subtitles from an .mkv file using ffmpeg into a separate file like a .sub or .idx? Or both?

Thank you for your help/advice.

Giacomo1968
  • 58,727

3 Answers3

6

Does not appear to be possible yet:
FFmpeg Bug Tracker: #2391 - VobSub muxer.

For now all you can do with ffmpeg is re-mux to MKV or VOB:

ffmpeg -i input.vob -map 0:s -c copy output.mkv
llogan
  • 63,280
1

ffmpeg will extract image-based subtitles into a standalone file. For example, where the 3rd stream is the subtitle in file.mkv...

PGS (.pgs):

ffmpeg -i file.mkv -map 0:2 -c:s:0 copy sub.pgs

VobSub (.vob):

ffmpeg -i file.mkv -map 0:2 -c:s:0 copy sub.vob

You can use a program such as SubtitleEdit to perform OCR on the standalone image-based subtitle file and export the result into a text based format, such as SRT (.srt).

0

I'll chime in on this as others may have problems with subtitles that are marked as dvd_subtitle.

I have been using ffmpeg to convert my files that were ripped using Makemkv and transcoding them for size. All of the subtitles are outputted as dvd_subtitle which are impossible to extract. What I've done is a bit messy but it allows me to add SUBRIP subtitles into my output files. I've just written this and it does not support multiple .srt files. I hope to get this more robust so as to extract and insert the SUBRIP subtiles for all that exist.

I have not found an answer as to why ffmpeg is converting the SUBRIP subtitles to this dvd_subtitle but it makes a mess out of things. I find that my TV doesn't display the subtitles very large but SUBRIP are fine.

First, I extract the subtitles from the source video:

ffmpeg -i %FILE% %FILE%TEMPSUBTITLE$$.srt

Second I copy the video without the subtitles in it:

ffmpeg -i %FILE% -c copy -sn %FILE%TEMPVIDEO$$.MKV

And finally I re-encode my files adding back the SRT file:

ffmpeg.exe -analyzeduration 100M -probesize 100M  -i TEMPVIDEO$$.MKV -f srt -i TEMPSUBTITLE$$.SRT %GPUENCODE% -vf scale=1920x1080 -crf 30  -c:s copy  -c:v libx264  -codec:a aac -rc-lookahead 8 -bf 8 %FILE%.conv.mkv
Destroy666
  • 12,350