[Libav-user] Decoding Packets, missing Frames at End

Alex Cohn alexcohn at netvision.net.il
Tue Feb 5 11:03:31 CET 2013


On Tue, Feb 5, 2013 at 11:58 AM, Ronny Wegener <max_schmerz at gmx.net> wrote:
> Hi,
>
> i'm running a simple while loop, reading all video packets, decode the
> corresponding frames and print the timestamps.
>
> The first frame is successfully decoded after reading the fifth
> packet. So the while loop stops after reading the last packet, before
> i decoded all frames:
>
> [OUTPUT]
>   packet.pts=0 => GOT NO PICTURE
>   packet.pts=1 => GOT NO PICTURE
>   packet.pts=2 => GOT NO PICTURE
>   packet.pts=3 => GOT NO PICTURE
>   packet.pts=4 => frame.pts=0
>   packet.pts=5 => frame.pts=1
>   packet.pts=6 => frame.pts=2
>   packet.pts=7 => frame.pts=3
>   packet.pts=8 => frame.pts=4
>   packet.pts=9 => frame.pts=5
> [END]
>
> It seems the packets are buffered, how can i decode the last frames
> from the internal buffered packets?

Your description is correct. After av_read_frame() returns FALSE, you
should continue to call avcodec_decode_video2() with empty input
packet while got_picture is TRUE.

BR,
Alex


More information about the Libav-user mailing list