[FFmpeg-devel] Order of demuxed packets after a seek in an ogg container.

Dale Curtis dalecurtis at chromium.org
Thu Jun 26 00:37:11 CEST 2014


Hi,

If av_seek_frame() is used to seek within a specific stream, are future
av_read_frame() calls guaranteed to return all packets from all other
streams in the container with timestamps after the seek timestamp?

We're noticing that this is not the case with some ogg files, for which
I've had to write up a workaround which involves considering the file
position of the packet (as indicated by AVPacket.pos). Chromium change for
reference: https://codereview.chromium.org/353563002/

We discovered this after adding code which uses the lowest packet timestamp
as seeking point when attempting to restarting playback from the beginning.
We were expecting a seek in the audio stream to avoid missing keyframe
corruption of the video stream if the first video timestamp was later in
the stream. Is this an invalid assumption? Again, here's the Chromium
change for reference: https://codereview.chromium.org/335273002/

Here's a test program and associated test data:

http://commondatastorage.googleapis.com/dalecurtis-shared/ogg-seek-test.zip

And the output which shows that after seeking in the audio stream (stream
1, since it has lowest pts) the video (stream 0) packets [0, 8] are not
returned:

0: pts: 00000 -- dts: 00000
0: pts: 00001 -- dts: 00001
0: pts: 00002 -- dts: 00002
0: pts: 00003 -- dts: 00003
0: pts: 00004 -- dts: 00004
0: pts: 00005 -- dts: 00005
0: pts: 00007 -- dts: 00007
0: pts: 00008 -- dts: 00008
1: pts: -0128 -- dts: -0128
1: pts: 00000 -- dts: 00000
1: pts: 00576 -- dts: 00576
1: pts: 01600 -- dts: 01600
1: pts: 02624 -- dts: 02624
1: pts: 03648 -- dts: 03648
1: pts: 04672 -- dts: 04672
1: pts: 05696 -- dts: 05696
1: pts: 06720 -- dts: 06720
1: pts: 07744 -- dts: 07744
1: pts: 08768 -- dts: 08768
1: pts: 09792 -- dts: 09792
1: pts: 10816 -- dts: 10816
1: pts: 11840 -- dts: 11840
1: pts: 12864 -- dts: 12864
1: pts: 13888 -- dts: 13888
1: pts: 14912 -- dts: 14912
1: pts: 15936 -- dts: 15936
1: pts: 16960 -- dts: 16960
1: pts: 17984 -- dts: 17984
1: pts: 19008 -- dts: 19008
1: pts: 20032 -- dts: 20032
--------------------
1: pts: -0128 -- dts: -0128
1: pts: 00000 -- dts: 00000
1: pts: 00576 -- dts: 00576
1: pts: 01600 -- dts: 01600
1: pts: 02624 -- dts: 02624
1: pts: 03648 -- dts: 03648
1: pts: 04672 -- dts: 04672
1: pts: 05696 -- dts: 05696
1: pts: 06720 -- dts: 06720
1: pts: 07744 -- dts: 07744
1: pts: 08768 -- dts: 08768
1: pts: 09792 -- dts: 09792
1: pts: 10816 -- dts: 10816
1: pts: 11840 -- dts: 11840
1: pts: 12864 -- dts: 12864
1: pts: 13888 -- dts: 13888
1: pts: 14912 -- dts: 14912
1: pts: 15936 -- dts: 15936
1: pts: 16960 -- dts: 16960
1: pts: 17984 -- dts: 17984
1: pts: 19008 -- dts: 19008
1: pts: 20032 -- dts: 20032
1: pts: 21056 -- dts: 21056
0: pts: 00010 -- dts: 00010
0: pts: 00011 -- dts: 00011
0: pts: 00013 -- dts: 00013
0: pts: 00014 -- dts: 00014
0: pts: 00015 -- dts: 00015
0: pts: 00016 -- dts: 00016
0: pts: 00017 -- dts: 00017

Thanks in advance for any insights!

- dale


More information about the ffmpeg-devel mailing list