[Libav-user] Fwd: decode/encode subtitles example

Marco Gulino marco.gulino at gmail.com
Mon Sep 23 14:04:21 CEST 2013

I'm pretty new to libav* development, and I'm mostly a c++ developer, not
C, so forgive me if I might ask dumb questions.

What I'm trying to achieve is to open a media file and extract a subtitle
Possibly in memory, but using a temp output file would be acceptable.

I did read the muxing/demuxing c examples, and following them I'm already
able to open the file, detect all streams, and decode the subtitle packets,
but I'm stuck in the "reencode" part.
There is an "avcodec_encode_subtitle" API, which seems undocumented
(there's an unofficial doc here, though:
http://wiki.aasimon.org/doku.php?id=ffmpeg:avcodec_encode_subtitle ).
You can see my code here: http://pastebin.com/cUxCs33a .
It's just a spike of course, quick & dirty... If I comment out the
avcodec_encode_subtitle line everything runs just fine, and I can even see
the subtitle lines if I print pkt.data.
the avcodec_encode_subtitle however, when called, always gives me a
segmentation fault.
Also, it's not clear how to save the buffer data to the newly created
stream (though maybe I won't need it, if the buffer will contain the raw
srt data).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130923/02bcee49/attachment.html>

More information about the Libav-user mailing list