[Libav-user] Deep copy of AVCodecContext

Zahir Dhada zahir.dhada at zeuslearning.com
Tue Apr 21 17:25:48 CEST 2015

Hi all,

My application receives live h264 stream from a source, which I decode
using libav. The source only sends an I-frame at the beginning of the
stream, and never after. My application allows a user to record the stream
at any random point in the stream, i.e., the user would press record button
and the application would start recording the stream from that point. From
the moment recording begins, I start storing the frames received in the
stream in a file. And when the stream ends, I read one frame at a time from
the file, and transcode it. The problem is, as the only I-frame I get is at
the beginning of the stream, I cannot decode the frames stored in the file
(as they are all P frames). I want to make a deep copy of the decoder I use
to decode the stream right before I start writing frames to the file. That
way I can resume decoding the frames stored in the file and re-encode them
using the copied context. But I cannot seem to find anything on how to make
a deep copy of the AVCodecContext.

Any help in the matter would be appreciated.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20150421/bd900ae6/attachment.html>

More information about the Libav-user mailing list