[Libav-user] missing frames while decoding
Nicolas George
nicolas.george at normalesup.org
Mon Jul 9 12:14:44 CEST 2012
Le duodi 22 messidor, an CCXX, Murthy avsn a écrit :
> Hi a l ,thanks for you support.I have problem with decoding frames. I am
> trying to save frames in a h264 stream to .PPM file.I am trying to decode
> a 00:00:02.08 sec video with "24fps" . Problem: problem is that I could
> only decode 46 frames from the video .I wounder where are those 2 frames
> missing.Here is the snapshot of the code
> while (av_read_frame(pFormatCtx, &packet) >= 0) { // Is this a packet from the video stream? if (packet.stream_index == videoStream) { // Decode video frame avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);
> // Did we get a video frame? if (frameFinished) { // Save the frame to disk SaveFrame(pFrameRGB, pCodecCtx->width, pCodecCtx->height, ++framecount); } }
> // Free the packet that was allocated by av_read_frame av_free_packet(&packet); }
That is unreadable. You should consider getting a more code-friendly mail
client if you intend to post on this kind of mailing list.
Regarding your problem, it seems you are not flushing the decoder. After the
input is finished, you have to feed empty packets to the decoder so that it
returns the frames that were delayed by previous B-frames.
Regards,
--
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/20120709/bfc21da3/attachment.asc>
More information about the Libav-user
mailing list