[Ffmpeg-devel] difference between av_read_packet() decoding and av_read_frame()
Thu Jun 22 15:27:29 CEST 2006
egf05 at doc.ic.ac.uk wrote:
> I see a different behaviour when decoding frames with the old and deprecated
> av_read_packet() function and av_read_frame().
> I need to decode mpeg frames from a video file. Using av_read_packet() to
> reconstruct a frame, I can get the video frames correctly. I can retrieve in
> AVFrame->data, data and data the three Y U and V buffers respectively,
> and can save them as a jpeg image.
> However, when I use the new av_read_frame() function, the AVFrame frames I get
> are sometimes garbled, with squares. Actually, it seems they look like P frames,
> with blocks that correspond to changes compared to the last keyframe. Is it
> normal? How to use av_read_frame() so that I could get "normal" decoded frames,
> one by one ?
I answer to myself, because I found the issue: I was using
// Inform the codec that we can handle truncated bitstreams -- i.e.,
// bitstreams where frame boundaries can fall in the middle of packets
if(pVCodec->capabilities & CODEC_CAP_TRUNCATED)
and this lead to corrupted av_read_frame() frames. This was necessary
for the old way to read frames (using av_read_packet(), but is on the
contrary harmful when using the new av_read_frame().
More information about the ffmpeg-devel