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).


3 Answers 3


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 Sep 12, 2018 at 15:46
  • Get the same error...
    – sard
    Sep 12, 2018 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. Sep 12, 2018 at 16:25
  • The second answer here, uses the same approach: superuser.com/questions/391892/extract-subtitles-from-movie (it has 3 votes) Sep 12, 2018 at 16:38
  • 1
    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, 2018 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, 2019 at 21:38

All the answers here seem to refer to subtitle streams (a stream of text or maybe images dedicated to just subtitles). Those can be extracted in many ways, for example just open the file with "Subtitle edit" and you can directly extract and manipulate text subtitles or convert image subtitles to text with OCR and then edit them anyway you want. But Closed Captions (CC) is another beast. Closed Captions are text subtitles embedded in the video stream, in old time broadcast TV, the analog signal was shown line by line in the CRT TV screen by an actual electron beam that physically swept the screen line by line, when reaching bottom it went to the top of the screen again and that took some time. In that interval, some modulation was used to send a signal that was not displayed (since the electron beam was going back to the start position), that signal encoded text information that was decoded as subtitles. That CC data can still be embedded in the video part of the digital files we use today, and some tools can decode it, for example VLC can show it, ffmpeg can access it (for example using "ffmpeg" -f lavfi -i "movie=output.mkv[out0+subcc]" -map s "output_map-s.srt" as the original question shows). I know only about another tool that can extract them to SRT files (or some other formats) with correct time codes, it is CCExtractor, programmed by CFSMP3, but it is a very picky tool that takes some effort to master and get results

You must log in to answer this question.

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