5

I'm writing a C program that uses the ffmpeg's libav* libs, and using Dranger's tutorial, I can decode both audio and video correctly. Currently, I'm trying to extract subtitles. I actually don't want to decode them on time and display them on the video, but actually extract the subtitle text out of the container.

For example, on the cli,

ffmpeg -i video.mkv -map 0:4 -scodec copy out.ass

would give me the ass file back. (For some reason, srts only return the text.)

I've tried messing with AVSubtitle, avcodec_decode_subtitle2, etc., but they're returning the subtitles line by line. I would like the timecodes in srts, header information in ass, etc. All I want is the entire subtitle text file that was muxed into the container.

John Smith
  • 396
  • 1
  • 3
  • 10

1 Answers1

-1

In the case of .mkv files, you could use mkvextract. You may need to use mkvinfo first to identify which track you want to extract.

Since you want to do this from your own C program, you would probably want to use the Matroska libraries instead of the command line tools.

mivk
  • 13,452
  • 5
  • 76
  • 69