3

These are the streams contained:

Stream #0:0[0x247]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x248](fra): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
    Stream #0:2[0x24c](fra,eng): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
    Stream #0:3[0x6c3](rus): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
    Stream #0:4[0x6c4](eng): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
    Stream #0:5[0x6c5](deu): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
    Stream #0:6[0x6c6](dut): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
    Stream #0:7[0x6c7](spa): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
    Stream #0:8[0x6c8](rum): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
    Stream #0:9[0x6c9](fra): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)

I refer to three online resources that I have followed: How to extract subtitle from video using ffmpeg?
https://trac.ffmpeg.org/wiki/ExtractSubtitles
https://newbedev.com/extract-every-audio-and-subtitles-from-a-video-with-ffmpeg

I tried everything in there, including the ffmpeg -txt_format text -i ... suggestion.

What comes out is usually something like

Output #0, srt, to 'subs.srt':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0(fra,eng): Subtitle: subrip (srt)
    Metadata:
      encoder         : Lavc58.54.100 srt
Stream mapping:
  Stream #0:2 -> #0:0 (dvb_teletext (libzvbi_teletextdec) -> subrip (srt))
Press [q] to stop, [?] for help
size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)

Or, with the .ass target,


Output #0, ass, to 'out.ass':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0(fra,eng): Subtitle: ass (ssa)
    Metadata:
      encoder         : Lavc58.54.100 ssa
Stream mapping:
  Stream #0:2 -> #0:0 (dvb_teletext (libzvbi_teletextdec) -> ass (ssa))
Press [q] to stop, [?] for help
size=       1kB time=00:00:00.00 bitrate=N/A speed=   0x    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:1kB muxing overhead: unknown

The file here is not empty, but contains

[Script Info]
; Script generated by FFmpeg/Lavc58.54.100
ScriptType: v4.00+
PlayResX: 384
PlayResY: 288

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text

I have tried if the subtitles are actually empty. They are not: mplayer shows them.

What can I do to extract them correctly?

1 Answer 1

3

dvbsub are bitmap-based subtitles.
Here's 2 steps to extract them (in your example for eng subtitles) :
1 : ffmpeg -i input -map 0:4 -c dvdsub -f matroska subtitles.mkv
2 : mkvextract subtitles.mkv tracks 0:sub
and you'll get 2 files : sub.idx (index file) and sub.sub (bitmap file)

5
  • Thanks, Alain1A45. This brings me to half a solution. Half, because I actually need 'usable' subtitles; subtitles that can be edited, handled. In my case, I am using kdenlive, and so far I haven't been able to do anything with these two files. One seems to contain timestamps, as text file. The other probably images.
    – udippel
    Nov 25, 2021 at 22:14
  • @udippel My answer is for the question: how to extract. To edit bitmap subtitles, I think you have to use software like OCR. Maybe SubtitleEdit.
    – Alain1A45
    Nov 25, 2021 at 22:41
  • Okay, thanks very much! Alain1A45!
    – udippel
    Nov 29, 2021 at 11:44
  • @Alain1A45 : Your answer doesn't work for me. I tried your instructions but in step 2 mkvextract gives me this error: "Error: Extraction of track ID 0 with the CodecID 'S_DVBSUB' is not supported." Any idea why?
    – summerrain
    Oct 27, 2023 at 19:28
  • @summerrain You are getting this error message because the conversion in step 1 did not work. Try replacing -map 0:4 with -map s.
    – Alain1A45
    Oct 27, 2023 at 23:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .