[Libav-user] What is the correct way to read frames

Oleg mybrokenbeat at gmail.com
Sun Mar 24 17:07:18 CET 2013

Yes, you need to flush decoder also.
You had errors while decoding because simple copying AVPacket's data and size no longer works(sorry, it was my fault). It should be like following:

uint8_t *orig_ptr;
ssize_t orig_size;

orig_ptr = pkt.data;
orig_size = pkt.size;

while (pkt.size > 0 && (size = av_decode_video2()) > 0)
	pkt.data += size;
	pkt.size -= size;

pkt.data = orig_ptr;
pkt.size = orig_size;


24.03.2013, в 17:42, Pauli Suuraho написал(а):

> > This code is not very readable, due to the ugly c++ coding style and bloat.
> Oh, sorry you had problems reading my code.
> >If I read it correctly, you are forgetting to flush the decoder after the
> >end of the stream. You have to feed empty packets to the decoder until it
> >returns no frame.
> That's it! demuxing.c example had example how to flush the codec.
> Now I'm nicely getting all the frames, well at least if there is one frame per packet.
> -Pauli
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130324/afbaa01a/attachment.html>

More information about the Libav-user mailing list