OggTheora

From XiphWiki
Jump to navigation Jump to search

Ogg Theora

Default field type: BIG ENDIAN unsigned integer

Field names in full caps refer to fields described in the Theora I specification. Lowercase refers to theora_info struct members from libtheora.

This is the Theora header for theora-alpha3:

(VMAJ=3, VMIN=2, VREV=0)

  0                   1                   2                   3
  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1| Byte
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | packtype      | Identifier char[6]: 'theora'                  | 0-3
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                                               | VMAJ          | 4-7
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | VMIN          | VREV          | FMBW: width >> 4              | 8-11
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | FMBH: height >> 4             | PICW: frame_width             | 12-15
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |               | PICH: frame_height                            | 16-19
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | PICX: offset_x| PICY: offset_y| FRN: fps_numerator            | 20-23
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                               | FRD: fps_denominator          | 24-27
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                               | PARN: aspect_numerator        | 28-31
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |               | PARD: aspect_denominator                      | 32-35
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | CS: colorspace| NOMBR: target_bitrate                         | 36-39
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | QUAL      | KFGSHIFT| PF| resv|                                 40-43
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Granulepos

* What is the number of the first *real* keyframe/frame in a theora stream ? Is it 0 or 1 ?

The first frame of the stream (if it hasn't been trimmed) is a keyframe. It is displayed between time = 0 and time = 1 * frame_rate. The granulepos for that frame is based on the count of frames after it's been shown, which is 1, not zero. The only Ogg pages in a theora stream with a 0 granulepos should be the headers.