[Libav-user] Why does av_seek_frame() not seek to a keyframe?
Hendrik Leppkes
h.leppkes at gmail.com
Mon Jul 23 20:28:55 CEST 2012
On Mon, Jul 23, 2012 at 7:12 PM, 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.)
>
>
I am quite sure neither MPEG-PS nor MPEG-TS has the ability to seek to a
keyframe. Its been a problem for me for a while and i've been over this
code many times.
All they do is a binary search for the timestamp, and when they arrive
close enough, they are done.
To compensate for this, decoders like MPEG-2 will simply discard frames
until they see a keyframe to start decoding from, so visual corruption is
avoided.
If you run those codecs with AVCodeContext.flags2 set to
CODEC_FLAG2_SHOW_ALL, you'll probably get plenty of corrupted frames before
a real frame is shown, however i do not know how to do that via ffmpeg
commandline to demonstrate.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120723/1fc5e323/attachment.html>
More information about the Libav-user
mailing list