[Libav-user] Deep copy of AVCodecContext

Carl Eugen Hoyos cehoyos at ag.or.at
Sat Apr 25 00:06:01 CEST 2015


Zahir Dhada <zahir.dhada at ...> writes:

> 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).

You cannot randomly cut a general h264 stream, this 
does not necessarily work.
It is not possible to save a state of the decoder 
to allow decoding such a randomly cut stream.
Either the stream allows to be cut ("intra-refresh" 
or something similar, valid h264 streams without 
I frames exist), in this case just feed frames 
into the decoder until it returns frames.
Or the stream only contains one I frame and you 
need this frame, then you can only start decoding 
from the beginning of the stream.

Carl Eugen



More information about the Libav-user mailing list