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

Ronny Wegener max_schmerz at gmx.net
Tue Feb 5 12:06:02 CET 2013


Thanks for the fast reply, it's working now...

for those interested, here is the code that uses empty packets to
decode frames from the internal buffer:

http://pastebin.com/HxurrH9S

On Tue, Feb 5, 2013 at 11:03 AM, Alex Cohn <alexcohn at netvision.net.il> wrote:
> 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
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user


More information about the Libav-user mailing list