1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | |
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/> |
---|
6 | <title>Ogg Vorbis Documentation</title> |
---|
7 | |
---|
8 | <style type="text/css"> |
---|
9 | body { |
---|
10 | margin: 0 18px 0 18px; |
---|
11 | padding-bottom: 30px; |
---|
12 | font-family: Verdana, Arial, Helvetica, sans-serif; |
---|
13 | color: #333333; |
---|
14 | font-size: .8em; |
---|
15 | } |
---|
16 | |
---|
17 | a { |
---|
18 | color: #3366cc; |
---|
19 | } |
---|
20 | |
---|
21 | img { |
---|
22 | border: 0; |
---|
23 | } |
---|
24 | |
---|
25 | #xiphlogo { |
---|
26 | margin: 30px 0 16px 0; |
---|
27 | } |
---|
28 | |
---|
29 | #content p { |
---|
30 | line-height: 1.4; |
---|
31 | } |
---|
32 | |
---|
33 | h1, h1 a, h2, h2 a, h3, h3 a { |
---|
34 | font-weight: bold; |
---|
35 | color: #ff9900; |
---|
36 | margin: 1.3em 0 8px 0; |
---|
37 | } |
---|
38 | |
---|
39 | h1 { |
---|
40 | font-size: 1.3em; |
---|
41 | } |
---|
42 | |
---|
43 | h2 { |
---|
44 | font-size: 1.2em; |
---|
45 | } |
---|
46 | |
---|
47 | h3 { |
---|
48 | font-size: 1.1em; |
---|
49 | } |
---|
50 | |
---|
51 | li { |
---|
52 | line-height: 1.4; |
---|
53 | } |
---|
54 | |
---|
55 | #copyright { |
---|
56 | margin-top: 30px; |
---|
57 | line-height: 1.5em; |
---|
58 | text-align: center; |
---|
59 | font-size: .8em; |
---|
60 | color: #888888; |
---|
61 | clear: both; |
---|
62 | } |
---|
63 | </style> |
---|
64 | |
---|
65 | </head> |
---|
66 | |
---|
67 | <body> |
---|
68 | |
---|
69 | <div id="xiphlogo"> |
---|
70 | <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a> |
---|
71 | </div> |
---|
72 | |
---|
73 | <h1>Ogg Vorbis I format specification: comment field and header specification</h1> |
---|
74 | |
---|
75 | <h1>Overview</h1> |
---|
76 | |
---|
77 | <p>The Vorbis text comment header is the second (of three) header |
---|
78 | packets that begin a Vorbis bitstream. It is meant for short, text |
---|
79 | comments, not arbitrary metadata; arbitrary metadata belongs in a |
---|
80 | separate logical bitstream (usually an XML stream type) that provides |
---|
81 | greater structure and machine parseability.</p> |
---|
82 | |
---|
83 | <p>The comment field is meant to be used much like someone jotting a |
---|
84 | quick note on the bottom of a CDR. It should be a little information to |
---|
85 | remember the disc by and explain it to others; a short, to-the-point |
---|
86 | text note that need not only be a couple words, but isn't going to be |
---|
87 | more than a short paragraph. The essentials, in other words, whatever |
---|
88 | they turn out to be, eg:</p> |
---|
89 | |
---|
90 | <blockquote><p> |
---|
91 | "Honest Bob and the Factory-to-Dealer-Incentives, _I'm Still Around_, |
---|
92 | opening for Moxy Früvous, 1997" |
---|
93 | </p></blockquote> |
---|
94 | |
---|
95 | <h1>Comment encoding</h1> |
---|
96 | |
---|
97 | <h2>Structure</h2> |
---|
98 | |
---|
99 | <p>The comment header logically is a list of eight-bit-clean vectors; the |
---|
100 | number of vectors is bounded to 2^32-1 and the length of each vector |
---|
101 | is limited to 2^32-1 bytes. The vector length is encoded; the vector |
---|
102 | contents themselves are not null terminated. In addition to the vector |
---|
103 | list, there is a single vector for vendor name (also 8 bit clean, |
---|
104 | length encoded in 32 bits). For example, the 1.0 release of libvorbis |
---|
105 | set the vendor string to "Xiph.Org libVorbis I 20020717".</p> |
---|
106 | |
---|
107 | <p>The comment header is decoded as follows:</p> |
---|
108 | |
---|
109 | <pre> |
---|
110 | 1) [vendor_length] = read an unsigned integer of 32 bits |
---|
111 | 2) [vendor_string] = read a UTF-8 vector as [vendor_length] octets |
---|
112 | 3) [user_comment_list_length] = read an unsigned integer of 32 bits |
---|
113 | 4) iterate [user_comment_list_length] times { |
---|
114 | |
---|
115 | 5) [length] = read an unsigned integer of 32 bits |
---|
116 | 6) this iteration's user comment = read a UTF-8 vector as [length] octets |
---|
117 | |
---|
118 | } |
---|
119 | |
---|
120 | 7) [framing_bit] = read a single bit as boolean |
---|
121 | 8) if ( [framing_bit] unset or end of packet ) then ERROR |
---|
122 | 9) done. |
---|
123 | </pre> |
---|
124 | |
---|
125 | <h2>Content vector format</h2> |
---|
126 | |
---|
127 | <p>The comment vectors are structured similarly to a UNIX environment variable. |
---|
128 | That is, comment fields consist of a field name and a corresponding value and |
---|
129 | look like:</p> |
---|
130 | |
---|
131 | <pre> |
---|
132 | comment[0]="ARTIST=me"; |
---|
133 | comment[1]="TITLE=the sound of Vorbis"; |
---|
134 | </pre> |
---|
135 | |
---|
136 | <ul> |
---|
137 | <li>A case-insensitive field name that may consist of ASCII 0x20 through |
---|
138 | 0x7D, 0x3D ('=') excluded. ASCII 0x41 through 0x5A inclusive (A-Z) is |
---|
139 | to be considered equivalent to ASCII 0x61 through 0x7A inclusive |
---|
140 | (a-z).</li> |
---|
141 | <li>The field name is immediately followed by ASCII 0x3D ('='); |
---|
142 | this equals sign is used to terminate the field name.</li> |
---|
143 | <li>0x3D is followed by the 8 bit clean UTF-8 encoded value of the |
---|
144 | field contents to the end of the field.</li> |
---|
145 | </ul> |
---|
146 | |
---|
147 | <h3>Field names</h3> |
---|
148 | |
---|
149 | <p>Below is a proposed, minimal list of standard field names with a |
---|
150 | description of intended use. No single or group of field names is |
---|
151 | mandatory; a comment header may contain one, all or none of the names |
---|
152 | in this list.</p> |
---|
153 | |
---|
154 | <dl> |
---|
155 | |
---|
156 | <dt>TITLE</dt> |
---|
157 | <dd>Track/Work name</dd> |
---|
158 | |
---|
159 | <dt>VERSION</dt> |
---|
160 | <dd>The version field may be used to differentiate multiple |
---|
161 | versions of the same track title in a single collection. |
---|
162 | (e.g. remix info)</dd> |
---|
163 | |
---|
164 | <dt>ALBUM</dt> |
---|
165 | <dd>The collection name to which this track belongs</dd> |
---|
166 | |
---|
167 | <dt>TRACKNUMBER</dt> |
---|
168 | <dd>The track number of this piece if part of a specific larger collection or album</dd> |
---|
169 | |
---|
170 | <dt>ARTIST</dt> |
---|
171 | <dd>The artist generally considered responsible for the work. In popular music |
---|
172 | this is usually the performing band or singer. For classical music it would be |
---|
173 | the composer. For an audio book it would be the author of the original text.</dd> |
---|
174 | |
---|
175 | <dt>PERFORMER</dt> |
---|
176 | <dd>The artist(s) who performed the work. In classical music this would be the |
---|
177 | conductor, orchestra, soloists. In an audio book it would be the actor who did |
---|
178 | the reading. In popular music this is typically the same as the ARTIST and |
---|
179 | is omitted.</dd> |
---|
180 | |
---|
181 | <dt>COPYRIGHT</dt> |
---|
182 | <dd>Copyright attribution, e.g., '2001 Nobody's Band' or '1999 Jack Moffitt'</dd> |
---|
183 | |
---|
184 | <dt>LICENSE</dt> |
---|
185 | <dd>License information, eg, 'All Rights Reserved', 'Any |
---|
186 | Use Permitted', a URL to a license such as a Creative Commons license |
---|
187 | ("www.creativecommons.org/blahblah/license.html") or the EFF Open |
---|
188 | Audio License ('distributed under the terms of the Open Audio |
---|
189 | License. see http://www.eff.org/IP/Open_licenses/eff_oal.html for |
---|
190 | details'), etc.</dd> |
---|
191 | |
---|
192 | <dt>ORGANIZATION</dt> |
---|
193 | <dd>Name of the organization producing the track (i.e. |
---|
194 | the 'record label')</dd> |
---|
195 | |
---|
196 | <dt>DESCRIPTION</dt> |
---|
197 | <dd>A short text description of the contents</dd> |
---|
198 | |
---|
199 | <dt>GENRE</dt> |
---|
200 | <dd>A short text indication of music genre</dd> |
---|
201 | |
---|
202 | <dt>DATE</dt> |
---|
203 | <dd>Date the track was recorded</dd> |
---|
204 | |
---|
205 | <dt>LOCATION</dt> |
---|
206 | <dd>Location where track was recorded</dd> |
---|
207 | |
---|
208 | <dt>CONTACT</dt> |
---|
209 | <dd>Contact information for the creators or distributors of the track. |
---|
210 | This could be a URL, an email address, the physical address of |
---|
211 | the producing label.</dd> |
---|
212 | |
---|
213 | <dt>ISRC</dt> |
---|
214 | <dd>ISRC number for the track; see <a href="http://www.ifpi.org/isrc/">the |
---|
215 | ISRC intro page</a> for more information on ISRC numbers.</dd> |
---|
216 | |
---|
217 | </dl> |
---|
218 | |
---|
219 | <h3>Implications</h3> |
---|
220 | |
---|
221 | <ul> |
---|
222 | <li>Field names should not be 'internationalized'; this is a |
---|
223 | concession to simplicity not an attempt to exclude the majority of |
---|
224 | the world that doesn't speak English. Field <emph>contents</emph>, |
---|
225 | however, use the UTF-8 character encoding to allow easy representation |
---|
226 | of any language.</li> |
---|
227 | <li>We have the length of the entirety of the field and restrictions on |
---|
228 | the field name so that the field name is bounded in a known way. Thus |
---|
229 | we also have the length of the field contents.</li> |
---|
230 | <li>Individual 'vendors' may use non-standard field names within |
---|
231 | reason. The proper use of comment fields should be clear through |
---|
232 | context at this point. Abuse will be discouraged.</li> |
---|
233 | <li>There is no vendor-specific prefix to 'nonstandard' field names. |
---|
234 | Vendors should make some effort to avoid arbitrarily polluting the |
---|
235 | common namespace. We will generally collect the more useful tags |
---|
236 | here to help with standardization.</li> |
---|
237 | <li>Field names are not required to be unique (occur once) within a |
---|
238 | comment header. As an example, assume a track was recorded by three |
---|
239 | well know artists; the following is permissible, and encouraged: |
---|
240 | <pre> |
---|
241 | ARTIST=Dizzy Gillespie |
---|
242 | ARTIST=Sonny Rollins |
---|
243 | ARTIST=Sonny Stitt |
---|
244 | </pre></li> |
---|
245 | </ul> |
---|
246 | |
---|
247 | <h2>Encoding</h2> |
---|
248 | |
---|
249 | <p>The comment header comprises the entirety of the second bitstream |
---|
250 | header packet. Unlike the first bitstream header packet, it is not |
---|
251 | generally the only packet on the second page and may not be restricted |
---|
252 | to within the second bitstream page. The length of the comment header |
---|
253 | packet is (practically) unbounded. The comment header packet is not |
---|
254 | optional; it must be present in the bitstream even if it is |
---|
255 | effectively empty.</p> |
---|
256 | |
---|
257 | <p>The comment header is encoded as follows (as per Ogg's standard |
---|
258 | bitstream mapping which renders least-significant-bit of the word to be |
---|
259 | coded into the least significant available bit of the current |
---|
260 | bitstream octet first):</p> |
---|
261 | |
---|
262 | <ol> |
---|
263 | <li>Vendor string length (32 bit unsigned quantity specifying number of octets)</li> |
---|
264 | <li>Vendor string ([vendor string length] octets coded from beginning of string |
---|
265 | to end of string, not null terminated)</li> |
---|
266 | <li>Number of comment fields (32 bit unsigned quantity specifying number of fields)</li> |
---|
267 | <li>Comment field 0 length (if [Number of comment fields]>0; 32 bit unsigned |
---|
268 | quantity specifying number of octets)</li> |
---|
269 | <li>Comment field 0 ([Comment field 0 length] octets coded from beginning of |
---|
270 | string to end of string, not null terminated)</li> |
---|
271 | <li>Comment field 1 length (if [Number of comment fields]>1...)...</li> |
---|
272 | </ol> |
---|
273 | |
---|
274 | <p>This is actually somewhat easier to describe in code; implementation of the above |
---|
275 | can be found in vorbis/lib/info.c:_vorbis_pack_comment(),_vorbis_unpack_comment()</p> |
---|
276 | |
---|
277 | <div id="copyright"> |
---|
278 | The Xiph Fish Logo is a |
---|
279 | trademark (™) of Xiph.Org.<br/> |
---|
280 | |
---|
281 | These pages © 1994 - 2005 Xiph.Org. All rights reserved. |
---|
282 | </div> |
---|
283 | |
---|
284 | </body> |
---|
285 | </html> |
---|