[Libav-user] what's wrong with this loop?

Dominic Laflamme flamz3d at gmail.com
Fri Dec 14 17:38:53 CET 2012


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.

So, my question is this: why would I only get 994 complete frames out of
1000? Clearly this has to do with some sort of DTS / PTS issue, but I was
under the impression that this type of loop ensured that frames would be
reordered properly (hence if(frameFinished)).

(btw, if I dump all frames using cmdline ffmpeg, I get 1000 files..., so my
video file is not corrupted or anything like that);

Any insight would be greatly appreciated!

regards,
—Dominic
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20121214/1735eda6/attachment.html>


More information about the Libav-user mailing list