[Libav-user] Why does av_seek_frame() not seek to a keyframe?

Carl Eugen Hoyos cehoyos at ag.or.at
Thu Jul 19 08:31:35 CEST 2012


Hendrik Leppkes <h.leppkes at ...> writes:

> On Thu, Jul 19, 2012 at 8:18 AM, Carl Eugen Hoyos wrote:
> Michael Bradshaw <mbradshaw <at> ...> writes:
> > But when I seek, the first packet returned out of the demuxer is
> > not a keyframe packet, and I have to read several (~45ish) packets
> > until I encounter a keyframe.
>
> Could you provide a sample that does not seek to a keyframe with
> ffmpeg -ss x -i input out.png
> (I tested this yesterday on random mpeg2video samples and afaict,
> it did work.)
> 
> This test is somewhat meaningless because it'll skip 
> non-keyframes in the decoder until it finds one.

Isn't this necessary for some codecs / at least for H264? Wouldn't 
the API do exactly the same?

> But the idea is to ensure that you can decode as of time X, 
> which means you need to seek to the last keyframe *before* 
> time X, which is something that is not supported currently.

I see.
(But am I wrong to assume that this is not generally possible, 
assuming large GOPs?)

Carl Eugen



More information about the Libav-user mailing list