Video output:

ffmpeg -i output.mkv

Input #0, matroska,webm, from 'output.mkv':


encoder : libebml v1.3.6 + libmatroska v1.4.9

creation_time : 2018-08-31T06:43:45.000000Z

Duration: 00:42:51.03, start: 0.000000, bitrate: 1928 kb/s

Stream #0:0: Video: h264 (Main), yuv420p(progressive), 960x540 [SAR 1:1 DAR 16:9], Closed Captions, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)

Using this:

"ffmpeg" -f lavfi -i "movie=output.mkv[out0+subcc]" -map s "output_map-s.srt"

I can extract the (CC) but with an odd time codes and tags.

1 00:00:00,019 --> 00:00:00,051 {\an7}dialogue

2 00:00:00,052 --> 00:00:00,134 {\an7}dialogue

3 00:00:00,135 --> 00:00:00,161 {\an7}dialogue

4 00:00:00,163 --> 00:00:00,178 {\an7}dialogue

5 00:00:00,179 --> 00:00:00,194 {\an7}dialogue

6 00:00:00,220 --> 00:00:00,246 {\an7}dialogue

7 00:00:00,272 --> 00:00:00,296 {\an7}-dialogue

What would be the correct sentence to extract synced (CC).



This worked for me, N is the subtitle index starting with 0:

ffmpeg -hide_banner -i myfile.mkv -map 0:s:N subtiles_N.srt
  • You have to replace N with a number, because the MKV can have multiple subtiles. This will get you the first subtitle: ffmpeg -hide_banner -i myfile.mkv -map 0:s:0 subtiles_zero.srt – Cesar Moore Sep 12 '18 at 15:46
  • Get the same error... – sard Sep 12 '18 at 15:55
  • It can't be the exact same error, if it is ''0:s:0' matches no streams.', it would be because the MKV has not subtitles. – Cesar Moore Sep 12 '18 at 16:25
  • The second answer here, uses the same approach: superuser.com/questions/391892/extract-subtitles-from-movie (it has 3 votes) – Cesar Moore Sep 12 '18 at 16:38
  • Thank you, but this works only with subtitles with their own streams: Stream #0:2: Subtitle: subrip (default). Not Close Caption encoded in video stream. – sard Sep 12 '18 at 17:16

I had the same issue, my easiest solution was to use Handbrake to convert it to an MP4 and tell it to add the CC as Subtitle.

Several tools then have an easy method to extract the Subtitle from the MP4 into a text SRT file.

Its a long way around but my media player point blank refuses to play embedded subtitles and only wants srt with the same name as the file I want to watch.

  • Thanks, but how would you tell to add the CC...? Anything I do the CC is ignored. – sard May 22 '19 at 21:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.