[ogg-dev] Does ogg segments include more than one Vorbis frame

Ralph Giles giles at thaumas.net
Mon Apr 8 09:18:23 PDT 2013

On 13-04-08 4:34 AM, Johnslion Woo wrote:

>      Does anybody know is it allowed for the OGG segment including more
> than one Vorbis frame?  Or should I consider about that?

Vorbis frames (packets) are split into ogg segments, not the other way
around. If the packet is < 255 bytes, it just goes in a single segment
by itself.

So if you have a sequence of packets with lengths of 24, 156, 720 and
203 bytes, those would be divided and packed into segments of length:

  24, 156, 255,255,210, 203

You know where the boundaries between the packets are because they're
where the segment length values in the lacing table are less than 255.

The point of segmentation is it provides a sort of unary encoding of the
packet boundaries. You can pack up to 255 segments into an ogg page, and
use the lacing table to find the boundaries. This design gives a good
tradeoff between header overhead and read complexity.

Does that answer your question?


More information about the ogg-dev mailing list