[Libav-user] Why does av_seek_frame() not seek to a keyframe?
Michael Bradshaw
mbradshaw at sorensonmedia.com
Thu Aug 2 20:30:06 CEST 2012
On Thu, Aug 2, 2012 at 12:10 PM, Roger Pack <rogerdpack2 at gmail.com> wrote:
> > 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.)
>
> With me, I get this:
>
> with this file: http://rogerdpack.t28.net/incoming/sintel.mpg
>
> $ ffmpeg -i sintel.mpg -vcodec copy -acodec copy -ss 90.0
> starting_at_90.mpg
>
> then try and use it again:
>
> $ ffmpeg -i starting_at_90.mpg -vframes 1 -f image2 -an snap.jpg
>
> I get this warning message:
> [mpeg2video @ 01f09860] warning: first frame is no keyframe
>
> Anybody know if this is expected? I almost don't think it is...
I could be wrong on my understanding, so someone please correct me if I
am...
I believe that does no seeking there. Putting -ss after the input will
cause ffmpeg to demux up to the requested timestamp, so it's not quite
related to seeking (putting -ss before the input will seek the input file).
Since -a/vcoded copy avoids re-encoding, it just copies the packets
(without regard to keyframes, iiuc). The packet closest to 90 seconds
probably isn't a keyframe, but since that's where you requested the start
it ffmpeg starts copying packets from there anyway.
Maybe there should be the ability to set a start time and copy packets,
starting with the closest keyframe packet to the requested time...
--Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120802/57f07e7a/attachment.html>
More information about the Libav-user
mailing list