<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div><div><div><div>Hello!<br></div>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.<br>

<br></div>What I'm trying to achieve is to open a media file and extract a subtitle track.<br>
</div>Possibly in memory, but using a temp output file would be acceptable.<br><br></div><div>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.<br>


</div><div>There is an "avcodec_encode_subtitle<span>" API, which seems undocumented (there's an unofficial doc here, though: <a href="http://wiki.aasimon.org/doku.php?id=ffmpeg:avcodec_encode_subtitle" target="_blank">http://wiki.aasimon.org/doku.php?id=ffmpeg:avcodec_encode_subtitle</a> ).<br>


</span></div><div><span>You can see my code here: <a href="http://pastebin.com/cUxCs33a" target="_blank">http://pastebin.com/cUxCs33a</a> .<br></span></div><div><span>It's just a spike of course, quick & dirty... If I comment out the </span><br>


avcodec_encode_subtitle<span> line everything runs just fine, and I can even see the subtitle lines if I print pkt.data.<br></span></div><div><span>the </span>avcodec_encode_subtitle<span></span> however, when called, always gives me a segmentation fault.<br>


</div><div>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).<br><br></div><div>Thanks!<span class="HOEnZb"><font color="#888888"><br>

</font></span></div><span class="HOEnZb"><font color="#888888"><div>Marco<br>
</div></font></span></div>
</div><br></div>