[opus] Ogg Format

Timothy B. Terriberry tterribe at xiph.org
Mon May 9 19:02:36 UTC 2016

Amit Ashara wrote:
> I am referring to the following file
> https://en.wikipedia.org/wiki/File:Sample_of_%22Another_Day_in_Paradise%22.ogg

The file you are looking at is an Ogg *Vorbis* file. It's not Opus at all.

The file at 
linked from <https://www.opus-codec.org/examples/> would be an example 
of an Ogg Opus file.

> I opened the file in a HEX editor. I do not see the string OpusHead in
> the packet. It starts with Oggs. Also checking the occurrence of Oggs, I
> see that the first packet has BOS, the next all (except last) have 00
> (which is not defined in the RFC as continuation) and last one has EOS.

The header_type byte is a set of bit flags. 00 means none of them are 
set, in which case the "unset: ..." language of each flag from RFC 3533 
applies. These pages are not continued pages.

> The first packet in this ogg file makes sense.
> The second packet (I am taking a part of it)

You mean page, not packet. They are different.

> 4f 67 67 53 = Oggs (THIS IS OK)
> 00 = Version (THIS IS OK)
> 00 = Header Type (WHY IS THIS 0)??

See above.

> 00 00 00 00 00 00 00 00 = Granule Position (THERE IS NO SPECIFIC

This is the correct value to use for header packets.

> 7e 46 00 00 = Bit Stream Serial Number (THIS IS OK)
> 01 00 00 00 = Page Sequence Number (THIS IS OK)
> 89 ab 50 5e = Checksum (THIS IS OK)
> 10 = Page Segments is 16, so there would be 16 segments after this
> 2d ff ff ff ff ff ff ff ff ff ff ff ff ff ff c1 = Each Segment Size (IS
> 03 76 6f = First 3 data from Segment 0 indicated by the size 2d (IS THIS

These are both correct.

More information about the opus mailing list