[FFmpeg-devel] ogg seeking status
Reimar.Doeffinger at gmx.de
Thu Feb 9 23:11:01 CET 2012
On Wed, Feb 08, 2012 at 05:06:29AM -0500, Don Moir wrote:
> Open this file like you would normally in some of your own code or
> use the MPlayer code to get it opened. I open the audio and video
> streams for this file.
> Then do: avformat (pFormatCtx, videoStreamIndex, INT64_MIN, 0x405c,
> For this file, the 0x405c corresponds to about 9 minutes.
> Start reading packets until you get the first videoStreamIndex
> packet using av_read_frame (pFormatCtx, &packet);
> The first videoStreamIndex packet should contain 0x1b41 for both the
> packet pts and dts values. 0x1b41 a little less than 4 minutes for
> the video stream for this file and this is way off.
Are you using latest FFmpeg?
$ ./mplayer -ss 9:00 bad_seek_not_accurate.ogv -quiet
Added some printout that prints stream number and pts value converted
ok, it starts demuxing a bit from the start before doing the
seek, a bit silly but not FFmpeg's fault - probably scanning
audio, stops with
[That is 9 minutes and 1.4 seconds where video starts.
Audio packets follow later and lack a time stamp at first]
[Here comes the first audio with a time stamp]
Looks just perfect to me, under 2 seconds off from the target.
There is also a keyframe it manages to find before 9 minutes,
if I specify 8:59:
The seek command used by MPlayer is (simplified):
if (av_seek_frame(avfc, -1, pts, 0) < 0)
av_seek_frame(avfc, -1, pts, AVSEEK_FLAG_BACKWARD);
More information about the ffmpeg-devel