[FFmpeg-devel] ogg seeking status
Reimar Döffinger
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,
> INT64_MAX);
>
> 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?
I run:
$ ./mplayer -ss 9:00 bad_seek_not_accurate.ogv -quiet
Added some printout that prints stream number and pts value converted
to seconds:
0 0.000000
0 0.033367
0 0.066733
0 0.100100
0 0.133467
[...
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
0 5.305305
0 5.338672
1 0.000000
]
0 541.441441
0 541.474808
0 541.508175
0 541.441441
[That is 9 minutes and 1.4 seconds where video starts.
Audio packets follow later and lack a time stamp at first]
1 542.004535
[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:
0 539.305973
0 539.339339
0 539.372706
[...]
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
mailing list