[Ffmpeg-devel] de/serializing AVFrames

Michael Niedermayer michaelni
Tue Jan 17 12:24:36 CET 2006


On Mon, Jan 16, 2006 at 11:48:18PM +0100, Tilman Kranz wrote:
> Hello everyone,
> For the purpose of reordering a sequence of pFrames I use a linked
> list of AVFrames as cache where I keep all (fully decoded) pFrames
> between two keyframes. I would like this cache to reside on disk if
> neccessary (it gets huge).

you do know about AVCodecContext.get/release_buffer() and they arent
doing what you want right?

> I saw what "avpicture_fill()" does. It assigns sizes and pointers, no
> plane data is modified. So I assume that I can (de)serialize what is
> referred to there as "ptr".
> Explicitly, as long as I persist information on "pixel format",
> "width" and "height" (from the codec context) I can reestablish the
> picture information of an AVFrame from a stored buffer by allocating
> a new one, restoring the buffer and running "avpicture_fill()" again
> with appropriate parameters.
> Am I correct? 

well, it depends upon what you do with the AVFrames afterwards, if you
want to resue motion vectors or such you must store them too, otherwise
width/height/the actual pixels/...
just try and see what happens, if it crashes its probably obvious from 
gdb what was missing

> Also, if there is a higher-level way to do it or it is
> likely to break in the future please let me know.

no highlevel way, unlikely to break once it works ...


More information about the ffmpeg-devel mailing list