Media Servers

Vorbis, Vorbis Comment, and Ogg Vorbis Explained

This article explains the differences between Vorbis, Vorbis Comment, and Ogg Vorbis.

Vorbis

Ogg. Vorbis. Comment. Same or different? What's the deal?

Vorbis confuses a lot of people. When you say, "Vorbis," what do you mean? Chances are, it doesn't mean what you think it does. Anytime Vorbis is discussed, it's quite common for there to be some confusion regarding what is being discussed. It's not your fault or theirs. The topic is very confusing. Vorbis - as a whole - is often spoke of incorrectly, and many people are confused about exactly what Vorbis is. On balance, this isn't surprising since there is more than one Vorbis standard, and Vorbis is often combined with other technologies, resulting in similar sounding names for different functions.

Why Vorbis Is Confusing

What causes most users to misunderstand Vorbis? First, the term "Vorbis" is often used in the same context as other technologies (predominantly Ogg). Often, people don't realize they are mangling two or more products together, believing they are one and the same when they're not. And, most people don't understand there are multiple products named Vorbis with different functions.

Let's begin by acknowledging some basic characteristics and facts about the Vorbis family:

  1. Vorbis and Vorbis Comment are not the same thing
  2. Vorbis is a codec
  3. Vorbis Comment may refer to either of two (2) completely different components with the same name:
    • Vorbis Comment (stand-alone) is a metadata schema
    • Vorbis Comments are contextual metadata fields inside a Vorbis codec file
  4. Ogg Vorbis is not a thing; the expression refers to a combination of a Vorbis codec inside an Ogg container

Vorbis: The Codec

Vorbis is an audio codec capable of supporting optional metadata.

When a Vorbis encoded audio stream contains metadata, it is referred to as comments. However, this is NOT the same thing as Vorbis Comments. Confused yet?

Vorbis Codec Headers

The data inside a Vorbis encoded file is grouped into three (3) sections of information. Each section is preceded by a header, which identifies the type of information in the corresponding section. Vorbis encoded files contain the following headers, in this order:

  1. Identification Header
  2. Comment Header
  3. Setup Header

A Vorbis file must contain all three (3) headers. This is how a device recognizes a Vorbis audio file. The Identification and Setup headers must contain valid data or the file will be rejected by the decoder. The Comment header may be devoid of data, but must exist. If any header is missing, the file will be rejected by the decoder as invalid.1

Vorbis comment Header [Codec]

Per its technical standard, the Vorbis decoder searches for a section in the Vorbis file with a header called "comment." The comment section of the Vorbis file may contain metadata or it may be empty. When metadata is present after the comment header, the decoder attempts to parse fields (tags) and values from the information. These field/value declarations are called comment vectors and follow the same syntax rules as Vorbis Comment metadata fields, which are:

  • UTF-8 characters
  • Limited to ASCII characters 0x20 through 0x7D (letters, numbers, and punctuation)
  • Equal sign (=) is excluded and cannot be used in a field name
  • Multiple key=value pairs with same key (field) name are allowed

Furthermore, the Vorbis codec specification recommends a particular structure for Vorbis comment vectors. The following fields ("tags") are suggested. The field IDs are case insensitive. Bear in mind these field (tag) names are suggested in the Vorbis codec documentation. They are not required.

  • ALBUM
  • ARTIST
  • CONTACT
  • COPYRIGHT
  • DATE
  • DESCRIPTION
  • GENRE
  • ISRC
  • LICENSE
  • LOCATION
  • ORGANIZATION
  • PERFORMER
  • TITLE
  • TRACKNUMBER
  • VERSION

Remember, we are talking about the Vorbis codec here. Thus, any embedded metadata in a file's comment header section makes sense if the encoded file is stand-alone, since it won't be able to use any other metadata. You may include a virtually unlimited2 number of these comment vectors (key/value combinations) in a single file, and a virtually unlimited length of data for each comment vector.

Both a Vorbis codec stream AND Vorbis Comment (metadata) may be stored in the same file.3

Vorbis Comment [Metadata]

Vorbis Comments are unstructured, arbitrary metadata found inside a container. That's it. Vorbis Comment is used by a variety of audio container types, because it's a rather good metadata format. Nuances of the metadata syntax are described in the preceding section.

Vorbis Codec vs. Vorbis Comment Metadata

What is the difference between metadata incorporated into a Vorbis encoded file and metadata presented as Vorbis Comments?

Reiterating the explanations above, files encoded with the Vorbis codec (Vorbis) will contain audio data and may contain metadata. Vorbis Comment files contain ONLY metadata, and must reside inside an audio container.

From the viewpoint of metadata structure, comment vectors (Vorbis codec metadata) and Vorbis Comments (stand alone metadata) are very similar. Technically, they are unstructured metadata. While they are required to conform to a UNIX-style variable declaration format (KEY=VALUE), their symtax is relatively freeform (though limited to a range of ASCII characters). The following restrictions apply to the field names (tag names), regardless of whether the metadata type is a comment (file header) vector or embedded as Vorbis Comment:

  • UTF-8 characters
  • Limited to ASCII characters 0x20 through 0x7D (letters, numbers, and punctuation)

Note the equal sign (=) is excluded and cannot be used in a field name. The = symbol functions as the delimiter between field name and field value. To enter multiple values for the same field (e.g. artist name), the same tag name is repeated.

Having Your Cake and Eating It Too (Vorbis Codec + Vorbis Comments)

Since Vorbis Comments are their own, stand-alone object, it's possible to combine both a Vorbis encoded audio stream and Vorbis Comment data in a single file. In order to do this, the file must be a container type supported by both the Vorbis codec and Vorbis Comment. The best example of this is Ogg, which was designed for this exact purpose.

Ogg Vorbis: Ogg Container + Vorbis Codec

This expression refers to a Vorbis encoded audio stream wrapped inside an Ogg container.

Ogg Vorbis (Vorbis Codec Inside an Ogg Container)

The similar terms between Vorbis (codec) and Vorbis Comments (stand alone metadata schema) are compounded by the fact Vorbis (the codec) is frequently found wrapped inside of Ogg (a container type). In fact, the same organization (Xiph.Org Foundation) created all three. The sub-sections below offer high-level explanations of what these things are and how they differ from one another. This is not a deep dive technical discussion and does not cover implementation.

Footnotes

1 Vorbis I specification. (27 February 2015). Section 4.2, p. 26.

2 The maximum combined length of field (tag) and value string length in bytes is 232-1 for both. The maximum number of individually specified comment vectors is also 232-1.

3 When file type is a container.

Bibliography

Vorbis audio compression. (n.d.). Xiph.Org. https://xiph.org/vorbis/

Vorbis Comment. (24 January 2020). Wikipedia. Wikimedia Foundation. https://en.wikipedia.org/wiki/Vorbis_comment