[Libav-user] what's wrong with this loop?
jettoblack at gmail.com
Fri Dec 14 18:30:17 CET 2012
On Fri, Dec 14, 2012 at 11:38 AM, Dominic Laflamme <flamz3d at gmail.com>wrote:
> I am attempting to sequentially fetch frames from a movie encoded with
> libx264. I am using a typical av_read_frame / av_decode_video2 loop (found
> in most demos out there) to fetch each frames. Like this:
> int nbFrames = 0;
> while ( av_read_frame () >= 0 )
> if ( frameFinished )
> Now, my video file has 1000 frames, but after the loop runs, nbFrames only
> got incremented to 994.
Your loop stops when av_read_frame() returns an error such as EOF. There
may still be decoded frames in memory. To get those frames out, pass an
empty AVPacket (size = 0, data = NULL) into av_decode_video2() until
frameFinished returns 0.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libav-user