[Libav-user] Frames are not visually lining up between my code and ffmpeg.exe

Michael Bradshaw mbradshaw at sorensonmedia.com
Tue Jun 26 20:44:04 CEST 2012


On Tue, Jun 26, 2012 at 12:34 PM, Simon Daniels
<simondaniels23 at gmail.com> wrote:
> // Is this a packet from the video stream?
> if (packet.stream_index == videoStreamIndex && frameLocation++ % frameSkip
> == 0)
> {
> // Decode video frame
> avcodec_decode_video2(pCodecCtx, pFrameYUV, &isFrameFinished, &packet);

You don't want to be doing it like this, I don't think. If there are B
frames in the video, this could really mess things up (because frame 2
could depend on decoding frame 1 just before it, but you skipped
decoding frame 1, so now frame 2 is junk/gets decoded wrong (and now
all the ones decoded after it will be junk frames too until you hit a
keyframe)).


More information about the Libav-user mailing list