[Vorbis-dev] ogg segmentation

xiphmont at xiph.org xiphmont at xiph.org
Sun Aug 17 15:42:40 PDT 2014


I'll try to be a bit more complete describing the structure of Ogg's
interleave and segmentation, and why it's constructed that way.  I
think you've gotten a bit confused by the lacing-value encoding using
runs of 255; that's not segmentation, it's the way packet length is
encoded.

An Ogg stream is divided into and interleaved in units of pages.  It's
designed as a streaming format with a guaranteed stream capture within
64kB.  Start reading anywhere in the stream, and you know that if it's
Ogg, you'll find, sync to and be able to navigate the stream structure
after seeing at most 64kB go past.  In most practical streams, that
bound is actually set lower (4kB or so) to reduce capture latency and
buffering requirements.

Ogg pages consist of a header that provides a capture pattern,
checksum, stream metadata, and then encoded lengths of the packets
(the payloads) in that page.  There may be no packets at all, there
may be zero length packets, multiple packets, or even fractional
packets.  If you consider some packets may be larger than the maximum
size of an Ogg page, you can see that sometimes a packet will need to
be split across multiple pages.

Ogg does not restrict the allowed sizes of packets (the payloads) it
carries.  In streams with lots of very small, variable-sized packets
(eg, low-bitrate audio where packets are typically 50-200 bytes or
so), the packet length encoding can be a significant portion of the
stream overhead.  Ogg uses a near-constant-overhead encoding where
packet length is encoded in a single byte with '255' indicating the
size is >=255 bytes, and the next byte is a continuation of the length
encoding.  This process repeats until the value is < 255.  If the last
byte is 255, then the packet is continued on the next page.  This
encoding has constant overhead of about half a percent regardless of
packet size.

Monty


On Wed, Aug 13, 2014 at 9:37 PM, Ajinkya Deshmukh
<ajinkyadeshmukh9 at gmail.com> wrote:
> Hi Ralph,
> I am sorry, posted wrong question.
> Could you please elaborate the answer of "What is the need of segmentation?"
> I am not able to understand how segmentation helps in interleaving and
> packing.
>
>
> On Thu, Aug 14, 2014 at 10:02 AM, Ajinkya Deshmukh
> <ajinkyadeshmukh9 at gmail.com> wrote:
>>
>> Hi Ralph,
>> Could you please elaborate the answer of "why"? I am not able to
>> understand how does segmentation help in interleaving and packing.
>>
>>
>>
>>
>> --
>> Thanks & Regards,
>> Ajinkya Deshmukh.
>
>
>
>
> --
> Thanks & Regards,
> Ajinkya Deshmukh.
>
> _______________________________________________
> Vorbis-dev mailing list
> Vorbis-dev at xiph.org
> http://lists.xiph.org/mailman/listinfo/vorbis-dev
>


More information about the Vorbis-dev mailing list