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

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to