[Libav-user] Why does av_seek_frame() not seek to a keyframe?
Michael Bradshaw
mbradshaw at sorensonmedia.com
Sun Aug 5 18:22:16 CEST 2012
On Sun, Aug 5, 2012 at 10:03 AM, Don Moir <donmoir at comcast.net> wrote:
> I think requiring AVSEEK_FLAG_ANY just side tracks the issue and could break
> some apps. I added a comment to ticket 1607.
>
> The way it works now is slightly broken and not convienent to work around
> but its close. It does seem like it should be more or less busy work to get
> it working probably. I say busy work because I think the seek code would
> need to be specialized somewhat to work in this case rather then using the
> generic seek code. I am guessing a bit.
Yeah, I read your comment and agree it may not be the best change.
I've added a comment, but for those who may not read the ticket, what
do people think of changing ff_seek_frame_binary() so that after it
finds a frame, and if AVSEEK_FLAG_ANY is not set, it reads backwards
until it finds a keyframe? This would fix it for more than just the
mpg case (if it's a problem for other formats; I don't know).
seek_frame_generic() seems like it will try to seek to a keyframe even
if AVSEEK_FLAG_ANY is set, which may be a problem. It will read up to
the requested time, and then keep reading until it finds a keyframe
(up to reading 1000 frames). I don't think seek_frame_generic() can be
fixed so that it finds a keyframe before the requested timestamp,
judging by the code.
--Michael
More information about the Libav-user
mailing list