[Ffmpeg-devel] Seeking and keyframes

Steve Willis steve
Sat Jun 18 02:47:38 CEST 2005


Please pardon my novice question. I'm working on a project where the 
user needs to analyze video frame by frame, and possibly cut video at 
any arbitrary frame (not necessarily a keyframe.) This is not the same 
as a typical video player...video does not have to be "played" in 
real-time, just stepped through frame by frame. More importantly, I need 
a way to get a frame for a particular time accurate to the frame (not to 
the closest keyframe.)

I've been looking at the documentation for av_seek_frame(), and I see 
that it seeks to the first keyframe before the given timestamp by 
default. Is there a simple way to change this behavior so it finds the 
previous keyframe and then regenerates the forward intra-frame to 
exactly match the timestamp? Alternatively, is there a simple way to use 
ffmpeg to transcode the video such that every frame is a keyframe?

A final (very beginner) question: why is seeking only to keyframes the 
default? Is it very inefficient to actually generate the exact frame for 
  a given timestamp each time a user seeks?



More information about the ffmpeg-devel mailing list