[Libav-user] decode/encode subtitles example
Marco Gulino
marco.gulino at gmail.com
Mon Sep 23 20:21:41 CEST 2013
update: I found out what was giving the segmentation fault, I simply forgot
to do an avcodec_open2 on the output codec.
Now encoding to ASS format works fine, but SRT gives me no error, but no
output either (avcodec_encode_subtitle returns 0).
I guess it should have something to do with the AVCodecContext
configuration, but without an example, it's hard to find out what exactly
is the problem..
On Mon, Sep 23, 2013 at 2:04 PM, Marco Gulino <marco.gulino at gmail.com>wrote:
> Hello!
> 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
> track.
> 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).
>
> Thanks!
> Marco
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130923/e021b6a3/attachment.html>
More information about the Libav-user
mailing list