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

Nicolas George nicolas.george at normalesup.org
Sun Mar 24 16:04:21 CET 2013

Le quartidi 4 germinal, an CCXXI, Pauli Suuraho a écrit :
> I'm a newcomer to use ffmpeg, and I've been bugging my mind about this one
> thing.
> I have videoclips (either h264 or prores), and I want to extract all the
> frames. I'm using 32 bit ffmpeg-20130322-git-e0e8c20-win32 zeranoe
> shared+dev and Qt compiled using MSVC2010.
> I'm using the following code to extract the frames.
> http://pastebin.com/DrC9H6g0

This code is not very readable, due to the ugly c++ coding style and bloat.

> If I have a test clip that is 30 frames, 30fps long, for some reason the
> lib always extracts only 24 frames and then says end of file.

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.

Note: the decoding example seems slightly invalid for that.

Please remember not to top-post on this mailing list; if you do not know
what it means, look it up.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130324/379a5102/attachment.asc>

More information about the Libav-user mailing list