[theora] Indexing Ogg files for faster seeking

Conrad Parker conrad at metadecks.org
Wed Sep 23 10:49:54 PDT 2009

2009/9/23 Chris Pearce <chris at pearce.org.nz>:
> On 9/22/2009 11:10 PM, j at v2v.cc wrote:
>> would this also work for ogg streams with more than one video, not that
>> this is common, but possible in theory. would in those cases an index
>> not need to reference the track it is indexing?
> Currently my index/indexer merges keyframe data from all streams. So if
> you had multiple video streams, and you wanted to seek to time t, the
> index would tell you the offset of the last page which lies before
> *every* streams' last keyframe before t.
> If you're only playing one of the video streams, then you may be seeking
> back more than you need to.
> We discussed this on #theora yesterday, and most people seemed to favour
> indexing stream individually, or having mulitple indexes which denote
> what stream(s) they index.
> A sensible use case is for subtitles. A subtitle track could be embedded
> with its pages spread much further apart than the keyframes for a video
> track. With the streams indexed separately, you could request the pages
> with the subtitles with a separate request/read if they're too far away
> from the A/V pages.

another advantage of having separate indices is that it can be
possible to rip tracks out and recalculate their keyframe index. So I
think one index packet per media track would be useful. Perhaps you
could just add it to the skeleton track, rather than introducing a new
track type.

OTOH, one thing I'm worried about is the cost of adding the index to
the beginning of a long file, which then requires rewriting the entire

Anyway, I like the style of this index, especially the use of existing
page checksums to ensure consistency ;-)

Could you transfer your spec to the Xiph wiki? we also need to discuss
implementation for Dirac etc.



More information about the theora mailing list