[theora] Liboggplay seeking artifacts

ogg.k.ogg.k at googlemail.com ogg.k.ogg.k at googlemail.com
Fri Jul 24 02:13:23 PDT 2009


> 1. Determine the maximum time between keyframes. This is the maximum of
> all streams':
> 	(max number of frames between keyframes) * (frame duration)
> Note:
> (number of frames between keyframes) = ((1 << granuleshift) - 1)
> You only really need to calculate this for streams with have a
> granuleshift (e.g. not vorbis streams).
>
> 2. Seek to t - (maximum time between keyframes) (using oggplay_seek()).
>
> 3. Decode forward (using oggplay_step_decode()) until the frame you get
> back has time t.

The canonical method is very similar:
1. seek to the frame just before time you want.
2. From the granpos of this frame, deduct the granpos of the preceding keyframe.
3. Seek to there.
4. Decode until you reach your original target.

This would work for all streams using the granshift method, whether or not
the max time between keyframes exists or is practical.


More information about the theora mailing list