[theora-dev] Theora packets with granulepos of -1

salsaman salsaman at gmail.com
Mon Feb 16 05:02:29 PST 2009


Robin,

You were asking about seeking,

Seeking in ogg is not easy. Here is the method I devised, which seems
the most efficient:

1) Parse stream headers to get data. Some files have a first keyframe
of 0, others have a first keyframe of 1.

2) Begin reading pages until we get at least one packet. Then check
the granulepos to find the first keyframe number (0 or 1). Store this
as e.g. keyframe_offset.

Then:

3) To get a target frame, first search through the file to find the
largest granulepos<=target, taking into account the keyframe_offset.


More information about the theora-dev mailing list