Applies to: Protocol and format interpretation for developers inspecting authorized media delivery.
The useful distinctions
- OpusHead identifies an Ogg Opus identification packet.
- The packet includes an output channel count and pre-skip.
- The input sample-rate field is not the required playback sample rate.
Use the header as a field map
The synthetic packet announces two output channels and a pre-skip of 312 samples. Its input sample-rate field records 48000. Keep those as three separate facts: channel layout, initial output trimming, and input-rate metadata. The fact that two of the values use sample-related units does not make them interchangeable. The packet's little-endian fields also need byte-order-aware reading rather than visually concatenating their hex digits.
Keep packet validity separate from stream validity
Nineteen bytes are enough for this identification packet with mapping family zero. They are not enough for a complete Ogg Opus stream, which also needs Ogg page framing, a comment header, and audio packets. A local byte review can confirm the signature and field serialization without decoding audio. The example makes that boundary explicit. For a real inspection, retain the header's values alongside the stream context, then check packet and granule timing separately. A plausible input sample-rate number should never be used as a shortcut to rewrite decoder timing or conclude that a captured stream has a particular acoustic bandwidth. The nineteen-byte packet is a useful fixture because every field can be accounted for. Adding or deleting a byte changes later boundaries, so check the total before assigning meaning to decoded values.
Worked example · synthetic
The fields are OpusHead, version 1, two channels, pre-skip 312, input rate 48000, zero gain, and mapping family 0. This is an identification packet only, not an Ogg file.
Valid Ogg Opus identification packet; Ogg framing and audio intentionally absent.
4F 70 75 73 48 65 61 64 01 02 38 01 80 BB 00 00 00 00 00Check the interpretation
- Check the 19-byte length.
- Read pre-skip and rate as little-endian values.
- Do not confuse original input rate with playback timing.