On Fri, Dec 14, 2012 at 11:38 AM, Dominic Laflamme <[email protected]>wrote:
> Hello,
> 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 )
> {
> av_decode_video2(&frameFinished);
> if ( frameFinished )
> {
> nbFrames++;
> }
> }
>
> Now, my video file has 1000 frames, but after the loop runs, nbFrames only
> got incremented to 994.
>
Hi Dominic,
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.
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user