[Theora] ogg + theora + seeking

Ralph Giles giles at xiph.org
Tue Apr 4 13:14:07 PDT 2006

On Tue, Apr 04, 2006 at 08:20:34PM +0200, Tom wrote:

> I read the following for seeking in ogg for a theora key-frame:

I should probably also mention that it's possible to identify theora 
keyframes just by examining the first byte of the packet. See the source 
for theora_packet_iskeyframe() in libtheora.

That's only helpful if you're doing a linear scan, of course. The idea 
with seeking is that (a) you need to know the keyframe granule shift so 
you can convert the theora page granulepos fields to a time value, and 
thus use them to inform a bisection search for the target seek point. 
Once you are there you can (b) use the odd two-part granulepos at the 
seek point to calculate the time offset to the previous keyframe and
thus seek *again* for a point where you can actually begin decoding.


More information about the Theora mailing list