[FFmpeg-trac] #1607(avformat:new): av_seek_frame() without AVSEEK_FLAG_ANY on mpg files returns success without seeking to a keyframe
FFmpeg
trac at avcodec.org
Mon Aug 6 22:34:10 CEST 2012
#1607: av_seek_frame() without AVSEEK_FLAG_ANY on mpg files returns success
without seeking to a keyframe
------------------------------------+------------------------------------
Reporter: mbradshaw | Owner:
Type: defect | Status: new
Priority: normal | Component: avformat
Version: git-master | Resolution:
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
------------------------------------+------------------------------------
Comment (by mbradshaw):
Replying to [comment:4 cehoyos]:
> Replying to [comment:3 DonMoir]:
> > mpeg2video failing sample file (6 MB):
> >
> > http://sms.pangolin.com/temp/mpeg2video_seek_to_non_keyframe.mpg
> I failed to extract a non-keyframe out of this sample with ffmpeg.
> If it is possible, please provide the command together with complete,
uncut console output.
Can you describe how you were able to extract only keyframes out of this
sample? Because I'm afraid we may not be on the same page (again). If
`av_seek_frame()` seeks to a keyframe, then the first packet out of
`av_read_frame()` should be a keyframe packet and the first call to
`avcodec_decode_video2()` with this packet should return a full decoded
frame. This is not the case. `av_seek_frame()` on this file (and other mpg
files) seeks to a non-keyframe, and the first several packets out of
`av_read_frame()` are not keyframe packets, and several calls must be made
to `avcodec_decode_video2()` before a full decoded frame is returned.
The problem isn't that you get a junk frame out (the decoder makes sure
you don't). The problem is that `av_seek_frame()` doesn't seek to a
keyframe packet (despite the fact that that's what it claims it does), and
several calls must be made to `av_read_frame()` before finally finding a
keyframe packet.
--
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1607#comment:5>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list