[Libav-user] Frames corruption when seeking...

Jean-Yves Avenard jyavenard at gmail.com
Fri May 30 14:02:36 CEST 2014

On 30 May 2014 21:40, wm4 <nfxjfg at googlemail.com> wrote:

> Then you're probably doing something wrong. It's easily possible that
> this "wrong" thing was right (or just didn't cause problems) before the
> recent API changes.

oh, I'm sure I am... The question is what :)

I'll keep looking

> Are you using av_frame_free()? AVFrames are reference counted in the
> most recent release, so freeing the data isn't as simple as it was.
> av_frame_free() should take care of this properly.

with FFmpeg 1.2 I actually didn't allocate the AVFrame.

I had simply:
    AVFrame frame;

and use avcodec_decode_audio4 with a pointer to frame.

avcodec_get_frame_defaults being obsolete now, I have changed this to:
    AVFrame *frame;
    if (!(frame = av_frame_alloc()))
        return AVERROR(ENOMEM);

    ret = avcodec_decode_audio4(ctx, frame, &got_frame, pkt);


but regardless of the method, the data pointed to within AVFrame is
never deallocated by either av_frame_free or avcodec_free_frame

Stepping into the code, it seems that the decoder is managing the
data, allocating it with get_buffer() and release it later...

so that makes sense.

> I get a mostly black screen with some artifacts when playing your video
> with vdpau decoding on an older nvidia card with binary drivers.

ah yes you're right... it's another video that gives me green blocks.

Maybe I should raise a bug then...

but seeing I couldn't reproduce it with mplayer, and as the new API
doesn't cause the issue, I thought the issue was on our side only,..

What are you using to play?

More information about the Libav-user mailing list