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

Michael Bradshaw mbradshaw at sorensonmedia.com
Mon Jul 23 19:29:04 CEST 2012


On Mon, Jul 23, 2012 at 11:12 AM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> Michael Bradshaw <mbradshaw at ...> writes:
>
>> Anyone have any answers on these two things? If the answer to the
>> above would be "yes" can anyone else verify that "ffmpeg -dump
>> -loglevel debug -ss 38 -i 704x480-m2v-ac3.mpg -vframes 1 out.jpg" does
>> not seek to a keyframe?
>
> As said, afaict it does seek to a keyframe.
> (But I may of course be wrong.)

Yes, and thanks for your help and sorry to keep bugging, but no one's
answered these questions:

Would these be considered "problematic:"

1) Seek is performed, first packet out of av_read_frame() has .flags=0
(meaning not a keyframe)
2) Seek is performed, avcodec_decode_video2() must be fed several
packets (57 in my test with ffmpeg command line, with #55 being the
only one with .flags=1 (keyframe)) before it gets a full frame out

If the either of those two are "yes, that's problematic/undesired
behavior" then I need someone to verify that it's not just me (and
afaict that needs to be done with -dump -loglevel debug (which afaict
no one has used) in order to show the first 54 packets returned aren't
keyframe packets). If the answer to the above two are "no, that's not
problematic/undesired behavior," then I guess we need to define and
document what "seeking to a keyframe" means because then there's a
misunderstanding.

Thanks Carl,

--Michael


More information about the Libav-user mailing list