[Libav-user] Why does av_seek_frame() not seek to a keyframe?
mbradshaw at sorensonmedia.com
Thu Jul 19 22:11:08 CEST 2012
On Thu, Jul 19, 2012 at 1:54 PM, Hendrik Leppkes <h.leppkes at gmail.com> wrote:
> If you want to do accurate seeks with only avformat, you have to add a lot
> of boilerplate on top of it right now - or if you want to do accurate seeks
> even with ffmpeg. Sure, if you tell it to seek, it'll output an image, but
> it won't be the image at the time you specified, it'll very likely be at a
> later point in time.
It's a bit ugly, yeah. I talked a bit about some seeking issues once
and Michael Neidermayer put a AVFMT_SEEK_TO_PTS flag for the demuxers
so they can denote whether they seek by PTS or DTS, but to be honest I
don't think all the relevant demuxers have it set (nut is the only one
I know that has it set that seeks by PTS).
Since seeking is done by DTS for most demuxers, yes, lavf users have
to use some extra boilerplate code to seek accurately by PTS (probably
in the form of multiple seeks where they step back if they've sought
too far). It's not very pretty, but I don't think accurate seeking can
be done in lavf without seeking being done by PTS, but I think Reimar
or someone mentioned that may not be possible in some formats/files. I
don't know exactly what can be done about it though...
More information about the Libav-user