# [Vorbis-dev] Re: Maximum possible size of vorbis packet...

Paul Bryson paul at msn.com
Thu Oct 21 10:59:52 PDT 2004

```"illiminable" <ogg at illiminable.com> wrote...
> So i'm looking to find out the largest possible size a vorbis packet could
> be... so basically the highest sample rate, highest quality, most channels
> that is likely to occur.

If you want the largest possible size, then you could assume that any packet
encoded in Vorbis is going to be less than the size of the audio in
uncompressed PCM.  So, figure out how much space that would take and you
have the ceiling for the packet size in Vorbis.  (I assume it would be
possible to make a packet larger with Vorbis than uncompressed, but there is
no need to cater to that as it is pointless.)

To figure out the max size, you need:
Maximum number of samples in a Vorbis packet
Maximum bit depth
Maximum number of channels

Vorbis decode has a size of 2^(4 bit UINT) samples. That gives 2^15, or
32768 samples as the maximum decodable output of a Vorbis packet.  I am
guess that is the same for what is encoded in the packet, but someone else
would have to say for sure.

Now the maximum practical audio stats you are likely to see in the near
future are DVD-Audio.  It allows 24bit/192kHz at 2 channel or 24bit/96kHz at
6 channel.  I am pretty sure I saw a DVD once that was 6.1 (7 channel) and
supposedly they will have 7.1 (8 channel) DVDs at some point.  So, we could
say 24 bit at 8 channels is the maximum bit depth you will see in the
consumer world any time soon.  I think only 6 channel has been done in
Vorbis so far, but lets take it to the extreme.

32768 * 24 * 8 = 6291456

6291456 bits is the maximum possible output from a vorbis packet.  This
gives 786,432 bytes as the maximum.  Granted you are probably never going to
see that.  And if the decoder would only do 6 channels now, then half a meg
is about the max.

Atamido

```