[Ffmpeg-devel] MPEG2 seeking broken

Ulrich von Zadow coder
Wed Jul 26 18:10:18 CEST 2006

Ulrich von Zadow wrote:

> Has this been fixed? We seem to be running into the same issue here, and 
> if there's any info we can provide to help, we will.

Ok, some more information on what I have been able to determine here: 
Seeking in mpeg1 and mpeg2 streams using

   av_seek_frame(formatcontext, vstream, time, AV_SEEK_FLAG_BACKWARD);

causes messages like

   [mpeg2video @ 0xb4ba61d0]Warning MVs not available
   [mpeg2video @ 0xb4ba61d0]releasing zombie picture
   [mpeg2video @ 0xb4ba61d0]warning: first frame is no keyframe

Also, the frames returned are clearly not the ones I seeked to.

The code works with other codecs - I've tested huffyuv, mjpeg, mpeg4, 
msmpeg and xvid. If the stream index is set to -1 and the time 
calculation changed appropriately:

   av_seek_frame (formatcontext, -1, time, AV_SEEK_FLAG_BACKWARD);

then everything works. The first two warning messages still appear, but 
the frames shown are the correct ones and the 'no keyframe' message 
doesn't appear anymore.

Any comments on this? I notice that fplay uses -1 as stream index when 
seeking, so the bug doesn't appear there. What risks am I taking if I 
omit the stream index? How does the decoder find the previous keyframe 
in this case?



More information about the ffmpeg-devel mailing list