Arjan wrote: > Hi all, > I am trying to implement a seek function for my video playback system. > I'll try to explain the problem by this example: (times in milliseconds) > > > SEEK DONE (seek to 5000, using AVSEEK_FLAG_BACKWARD) > VIDEO PTS FOUND: 4960 (key frame) > VIDEO PTS FOUND: 5000 > VIDEO PTS FOUND: 5040 > VIDEO PTS FOUND: 5040 > VIDEO PTS FOUND: 5080 > VIDEO PTS FOUND: 5120 > VIDEO PTS FOUND: 5160 (key frame) > VIDEO PTS FOUND: 5200 > VIDEO PTS FOUND: 5240 > VIDEO PTS FOUND: 5280 > WRITTEN PTS [5280] INTO BUFFER (avcodec_decode_video returned frame) > > > Here's what's happening; I tried seeking to 5000ms, I used the > AVSEEK_FLAG_BACKWARD so I would get the first keyframe before the time I > need. This seems to work fine, as the first PTS which is found, is a > keyframe. The next frame is the valid frame, but avcodec_decode_video > does not return a frame. > It's only at pts 5280, when there has been another key frame and several > B frames, that avcodec_decode_video finally returns a frame. > > I would like to know if this is expected behaviour,
Impossible to tell without knowing the GOP structure. Besides, is PTS 5040 really duplicated? That is suspect. > and if it is, how > can I make sure I get the frame I need as fast as possible? There are the fields hurry_up, skip_frame and skip_idct in the codec context, that might be a solution. Just a guess though, I dont know what they do exactly. > > thanks in advance, > -- Michel Bardiaux http://www.mediaxim.com/ _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
