summaryrefslogtreecommitdiffstats
path: root/www/docs/mpeghdr.t
blob: 1bf92074029c818840894feeeff9a8bedbb73926 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
#define _PAGE_ MPEG Audio Frame Header
#include "head.t"

<P>This is a brief and informal document targeted to those who want to deal
with the MPEG format. If you are one of them, you probably already know what
is MPEG audio. If not, jump to <A
HREF="http://www.mp3.com/">http://www.mp3.com/</A> or <A
HREF="http://www.layer3.org/">http://www.layer3.org/</A> where you will find
more details and also more links. This document does not cover compression and
decompression algorithm.

<P>NOTE: You cannot just search the Internet and find the MPEG audio specs. It 
is copyrighted and you will have to pay quite a bit to get the Paper. That's why 
I made this. Information I got is gathered from the Internet, and mostly originate 
from program sources I found available for free. Despite my intention to always 
specify the information sources, I am not able to do it this time. Sorry, I did 
not maintain the list. :-( 
<P><B>These are not a decoding specs, it just informs you how to read the </B><A
HREF="#MPEG HEADER"><B>MPEG headers</B></A><B> and the </B> <A HREF="#MPEGTAG" 
TARGET=""><B>MPEG TAG</B></A><B>. MPEG Version 1, 2 and 2.5 and Layer I, II 
and III are supported, the MP3 TAG (ID3v1 and ID3v1.1) also.</B>. Those of you 
who use Delphi may find <A 
HREF="http://www.dv.co.yu/mpgscript/mpgtools.htm">MPGTools Delphi unit (freeware source)</A> 
useful, it is where I implemented this stuff. 

<P>I do not claim information presented in this document is accurate. At first 
I just gathered it from different sources. It was not an easy task but I needed 
it. Later, I received lots of comments as feedback when I published this document. 
I think this last release is highly accurate due to comments and corrections I 
received. 
<P>This document is last updated on December 22, 1999. 
<P ALIGN="center"><FONT SIZE="5"><B>MPEG Audio Compression Basics</B></FONT>

<P>This is one of many methods to compress audio in digital form trying to consume 
as little space as possible but keep audio quality as good as possible. MPEG compression 
showed up as one of the best achievements in this area. 
<P>This is a lossy compression, which means, you will certainly loose some audio 
information when you use this compression methods. But, this lost can hardly be 
noticed because the compression method tries to control it. By using several quite 
complicate and demanding mathematical algorithms it will only loose those parts 
of sound that are hard to be heard even in the original form. This leaves more 
space for information that is important. This way you can compress audio up to 
12 times (you may choose compression ratio) which is really significant. Due to 
its quality MPEG audio became very popular. 
<P>MPEG standards MPEG-1, MPEG-2 and MPEG-4 are known but this document covers 
first two of them. There is an unofficial MPEG-2.5 which is rarely used. It is 
also covered. 
<P><B>MPEG-1 audio</B> (described in ISO/IEC 11172-3) describes three Layers of audio coding with the following properties:
<LI>one or two audio channels
<LI>sample rate 32kHz, 44.1kHz or 48kHz.
<LI>bit rates from 32kbps up to 448kbps<BR>
Each layer has its merits.

<P><B>MPEG-2 audio</B> (described in ISO/IEC 13818-3) has two extensions to MPEG-1, usually referred as MPEG-2/LSF and MPEG-2/Multichannel.
<P>MPEG-2/LSF has the following properties:
<LI>one or two audio channels
<LI>sample rates half those of MPEG-1
<LI>bit rates from 8 kbps up to 256kbps.

<P>MPEG-2/Multichannel has the following properties:
<LI>up to 5 full range audio channels and an LFE-channel (Low Frequency
Enhancement <> subwoofer!)
<LI>sample rates the same as those of MPEG-1
<LI>highest possible bitrate goes up to about 1Mbps for 5.1


<P ALIGN="center"><A NAME="MPEG HEADER"></A><FONT SIZE="5"><B>MPEG Audio Frame
Header</B></FONT>

<P>An MPEG audio file is built up from smaller parts called frames. Generally, 
frames are independent items. Each frame has its own header and audio informations. 
There is no file header. Therefore, you can cut any part of MPEG file and play 
it correctly (this should be done on frame boundaries but most applications will 
handle incorrect headers). For Layer III, this is not 100% correct. Due to internal 
data organization in MPEG version 1 Layer III files, frames are often dependent 
of each other and they cannot be cut off just like that. 
<P>When you want to read info about an MPEG file, it is usually enough to find 
the first frame, read its header and assume that the other frames are the same 
This may not be always the case. Variable bitrate MPEG files may use so called 
bitrate switching, which means that bitrate changes according to the content of 
each frame. This way lower bitrates may be used in frames where it will not reduce 
sound quality. This allows making better compression while keeping high quality 
of sound. 
<P>The frame header is constituted by the very first four bytes (32bits) in a 
frame. The first eleven bits (or first twelve bits, see below about frame sync) 
of a frame header are always set and they are called &quot;frame sync&quot;. Therefore, 
you can search through the file for the first occurence of frame sync (meaning 
that you have to find a byte with a value of 255, and followed by a byte with 
its three (or four) most significant bits set). Then you read the whole header 
and check if the values are correct. You will see in the following table the exact 
meaning of each bit in the header, and which values may be checked for validity. 
Each value that is specified as reserved, invalid, bad, or not allowed should 
indicate an invalid header. Remember, this is not enough, frame sync can be easily 
(and very frequently) found in any binary file. Also it is likely that MPEG file 
contains garbage on it's beginning which also may contain false sync. Thus, you 
have to check two or more frames in a row to assure you are really dealing with 
MPEG audio file. 
<P>Frames may have a CRC check. The CRC is 16 bits long
and, if it exists, it follows the frame header. After the CRC comes the audio
data. You may calculate the length of the frame and use it if you need to read
other headers too or just want to calculate the CRC of the frame, to compare
it with the one you read from the file. This is actually a very good method to
check the MPEG header validity.

<P>Here is &quot;graphical&quot; presentation of the header content. Characters 
from A to M are used to indicate different fields. In the table, you can see 
details about the content of each field. 
<P ALIGN="center">
<B><TT><FONT SIZE="5">
AAAAAAAA AAABBCCD EEEEFFGH IIJJKLMM
</FONT>
</TT></B>

<P><CENTER>

<TABLE BORDER="0" CELLSPACING=7>
<TR VALIGN=TOP BGCOLOR="#E2E2E2">
<TD>Sign</TD><TD>Length<BR>(bits)</TD><TD>Position<BR>(bits)</TD><TD>Description</TD>
</TR>

<TR VALIGN=TOP>
<TD>A</TD><TD>11</TD><TD>(31-21)</TD><TD>Frame sync (all bits set)</TD>
</TR>

<TR VALIGN=TOP>
<TD>B</TD><TD>2</TD><TD>(20,19)</TD><TD>MPEG Audio version ID<BR>          
00 - MPEG Version 2.5<BR>01 - reserved<BR>10 - MPEG Version 2 (ISO/IEC 13818-3)<BR>11 - MPEG Version 1 (ISO/IEC 11172-3)
<P>Note: MPEG Version 2.5 is not official standard. Bit No 20 in frame header 
is used to indicate version 2.5. Applications that do not support this MPEG version 
expect this bit always to be set, meaning that frame sync (A) is twelve bits long, 
not eleve as stated here. Accordingly, B is one bit long (represents only bit 
No 19). I recommend using methodology presented here, since this allows you to 
distinguish all three versions and keep full compatibility.
</TD>
</TR>

<TR VALIGN=TOP><TD>C</TD><TD>2</TD><TD>(18,17)</TD>
<TD>Layer description<BR>          
00 - reserved<BR>
01 - Layer III<BR>
10 - Layer II<BR>
11 - Layer I</TD>
</TR>

<TR VALIGN=TOP>
<TD>D</TD><TD>1</TD><TD>(16)</TD>
<TD>Protection bit<BR>          
0 - Protected by CRC (16bit crc follows header)<BR>
1 - Not protected</TD>
</TR>
<TR VALIGN=TOP><TD>E</TD><TD>4</TD><TD>(15,12)</TD><TD>Bitrate index<BR>     
<TABLE BORDER="1" CELLSPACING="0" CELLPADING="0">
<TR><TD>bits</TD><TD>V1,L1</TD><TD>V1,L2</TD><TD>V1,L3</TD><TD>V2,L1</TD><TD>V2, L2 &amp; L3</TD></TR>
<TR><TD>0000</TD><TD>free</TD><TD>free</TD><TD>free</TD><TD>free</TD><TD>free</TD></TR>
<TR><TD>0001</TD><TD>32</TD><TD>32</TD><TD>32</TD><TD>32</TD><TD>8</TD></TR>
<TR><TD>0010</TD><TD>64</TD><TD>48</TD><TD>40</TD><TD>48</TD><TD>16</TD></TR>
<TR><TD>0011</TD><TD>96</TD><TD>56</TD><TD>48</TD><TD>56</TD><TD>24</TD></TR>
<TR><TD>0100</TD><TD>128</TD><TD>64</TD><TD>56</TD><TD>64</TD><TD>32</TD></TR>
<TR><TD>0101</TD><TD>160</TD><TD>80</TD><TD>64</TD><TD>80</TD><TD>40</TD></TR>
<TR><TD>0110</TD><TD>192</TD><TD>96</TD><TD>80</TD><TD>96</TD><TD>48</TD></TR>
<TR><TD>0111</TD><TD>224</TD><TD>112</TD><TD>96</TD><TD>112</TD><TD>56</TD></TR>
<TR><TD>1000</TD><TD>256</TD><TD>128</TD><TD>112</TD><TD>128</TD><TD>64</TD></TR>
<TR><TD>1001</TD><TD>288</TD><TD>160</TD><TD>128</TD><TD>144</TD><TD>80</TD></TR>
<TR><TD>1010</TD><TD>320</TD><TD>192</TD><TD>160</TD><TD>160</TD><TD>96</TD></TR>
<TR><TD>1011</TD><TD>352</TD><TD>224</TD><TD>192</TD><TD>176</TD><TD>112</TD></TR>
<TR><TD>1100</TD><TD>384</TD><TD>256</TD><TD>224</TD><TD>192</TD><TD>128</TD></TR>
<TR><TD>1101</TD><TD>416</TD><TD>320</TD><TD>256</TD><TD>224</TD><TD>144</TD></TR>
<TR><TD>1110</TD><TD>448</TD><TD>384</TD><TD>320</TD><TD>256</TD><TD>160</TD></TR>
<TR><TD>1111</TD><TD>bad</TD><TD>bad</TD><TD>bad</TD><TD>bad</TD><TD>bad</TD></TR>
</TABLE>
<P>
NOTES: All values are in kbps<BR>
V1 - MPEG Version 1<BR>
V2 - MPEG Version 2 and Version 2.5<BR>
L1 - Layer I<BR>
L2 - Layer II<BR>
L3 - Layer III<BR>
&quot;free&quot; means free format. If the correct fixed bitrate (such files cannot 
use variable bitrate) is different than those presented in upper table it must 
be determined by the application. This may be implemented only for internal purposes 
since third party applications have no means to find out correct bitrate. Howewer, 
this is not impossible to do but demands lot's of efforts.<BR>
&quot;bad&quot; means that this is not an allowed value

<P>MPEG files may have variable bitrate (VBR). This means that bitrate in the file may change. I have learned about two used methods:
<LI>bitrate switching. Each frame may be created with different bitrate. It may be used in all layers. Layer III decoders must support this method. Layer I & II decoders may support it.
<LI>bit reservoir. Bitrate may be borrowed (within limits) from previous frames 
in order to provide more bits to demanding parts of the input signal. This causes, 
however, that the frames are no longer independent, which means you should not 
cut this files. This is supported only in Layer III. 
<P>More about VBR you may find on <A HREF="http://www.xingtech.com/">Xing Tech 
site</A>
<P>For Layer II there are some combinations of bitrate and mode which are not 
allowed. Here is a list of allowed combinations. 
<TABLE BORDER=1 CELLSPACING=0>
<TR> 
<TD>bitrate</TD>
<TD>allowed modes</TD>
</TR>
<TR> 
<TD>free</TD>
<TD>all</TD>
</TR>
<TR> 
<TD>32</TD>
<TD>single channel</TD>
</TR>
<TR> 
<TD>48</TD>
<TD>single channel</TD>
</TR>
<TR> 
<TD>56</TD>
<TD>single channel</TD>
</TR>
<TR> 
<TD>64</TD>
<TD>all</TD>
</TR>
<TR> 
<TD>80</TD>
<TD>single channel</TD>
</TR>
<TR> 
<TD>96</TD>
<TD>all</TD>
</TR>
<TR> 
<TD>112</TD>
<TD>all</TD>
</TR>
<TR> 
<TD>128</TD>
<TD>all</TD>
</TR>
<TR> 
<TD>160</TD>
<TD>all</TD>
</TR>
<TR> 
<TD>192</TD>
<TD>all</TD>
</TR>
<TR> 
<TD>224</TD>
<TD>stereo, intensity stereo, dual channel</TD>
</TR>
<TR> 
<TD>256</TD>
<TD>stereo, intensity stereo, dual channel</TD>
</TR>
<TR> 
<TD>320</TD>
<TD>stereo, intensity stereo, dual channel</TD>
</TR>
<TR> 
<TD>384</TD>
<TD>stereo, intensity stereo, dual channel</TD>
</TR>
</TABLE>
</TD></TR>
<TR VALIGN=TOP>
<TD>F</TD><TD>2</TD><TD>(11,10)</TD>
<TD>Sampling rate frequency index (values are in Hz) 
<TABLE BORDER="1" CELLSPACING="0" CELLPADING="0">
<TR><TD>bits</TD><TD>MPEG1</TD><TD>MPEG2</TD><TD>MPEG2.5</TD></TR>
<TR><TD>00</TD><TD>44100</TD><TD>22050</TD><TD>11025</TD></TR>
<TR><TD>01</TD><TD>48000</TD><TD>24000</TD><TD>12000</TD></TR>
<TR><TD>10</TD><TD>32000</TD><TD>16000</TD><TD>8000</TD></TR>
<TR><TD>11</TD><TD>reserv.</TD><TD>reserv.</TD><TD>reserv.</TD></TR>
</TABLE>
</TD></TR>

<TR VALIGN=TOP>
<TD>G</TD><TD>1</TD><TD>(9)</TD>
<TD>Padding bit<BR>          
0 - frame is not padded<BR>
1 - frame is padded with one extra slot<BR>

Padding is used to fit the bit rates exactly. For an example: 128k 44.1kHz layer II uses a lot of 418 bytes and some of 417 bytes long frames to get the exact 128k bitrate. For Layer I slot is 32 bits long, for Layer II and Layer III slot is 8 bits long.



<P><B>How to calculate frame length</B>

<P>First, let's distinguish two terms frame size and frame length. Frame size 
is the number of samples contained in a frame. It is constant and always 384 samples 
for Layer I and 1152 samples for Layer II and Layer III. Frame length is length 
of a frame when compressed. It is calculated in slots. One slot is 4 bytes long 
for Layer I, and one byte long for Layer II and Layer III. When you are reading 
MPEG file you must calculate this to be able to find each consecutive frame. Remember, 
frame length may change from frame to frame due to padding or bitrate switching. 
<P>Read the BitRate, SampleRate and Padding of the frame header. 
<P>For Layer I files us this formula: 
<P ALIGN=CENTER>FrameLengthInBytes = (12 * BitRate / SampleRate + Padding) * 4
<P ALIGN=LEFT>For Layer II & III files use this formula:
<P ALIGN=CENTER>FrameLengthInBytes = 144 * BitRate / SampleRate + Padding 
<P>Example:<BR>
Layer III, BitRate=128000, SampleRate=441000, Padding=0<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ==&gt;&nbsp; FrameSize=417 bytes 
</TD></TR>

<TR VALIGN=TOP><TD>H</TD><TD>1</TD><TD>(8)</TD>
<TD>Private bit. It may be freely used for specific needs of an application, i.e. if it has to trigger some application specific events.</TD>
</TR>

<TR VALIGN=TOP><TD>I</TD><TD>2</TD><TD>(7,6)</TD>
<TD>Channel Mode<BR>          
00 - Stereo<BR>
01 - Joint stereo (Stereo)<BR>
10 - Dual channel (Stereo)<BR>
11 - Single channel (Mono)</TD>
</TR>

<TR VALIGN=TOP><TD>J</TD><TD>2</TD><TD>(5,4)</TD>
<TD>Mode extension (Only if Joint stereo)
<P>Mode extension is used to join informations that are of no use for stereo effect, thus reducing needed resources. These bits are dynamically determined by an encoder in Joint stereo mode.

<P>Complete frequency range of MPEG file is divided in subbands There are 32 subbands. For Layer I & II these two bits determine frequency range (bands) where intensity stereo is applied. For Layer III these two bits determine which type of joint stereo 

is used (intensity stereo or m/s stereo). Frequency range is determined within decompression algorythm.

<TABLE BORDER="0" CELLSPACING="2" CELLPADDING="0">
<TR><TD ALIGN=CENTER>Layer I and II</TD><TD ALIGN=CENTER>Layer III</TD></TR>
<TR VALIGN=TOP><TD> 
<TABLE BORDER="1" CELLSPACING="0" CELLPADING="0">
<TR><TD>value</TD><TD>Layer I &amp; II</TD></TR>
<TR><TD>00</TD><TD>bands 4 to 31</TD></TR>
<TR><TD>01</TD><TD>bands 8 to 31</TD></TR>
<TR><TD>10</TD><TD>bands 12 to 31</TD></TR>
<TR><TD>11</TD><TD>bands 16 to 31</TD></TR></TABLE>
</TD>

<TD> 
<TABLE BORDER="1" CELLSPACING="0" CELLPADING="0" WIDTH="212">
<TR ALIGN=CENTER><TD>Intensity stereo</TD><TD>MS stereo</TD></TR>
<TR ALIGN=CENTER><TD>off</TD><TD>off</TD></TR>
<TR ALIGN=CENTER><TD>on</TD><TD>off</TD></TR>
<TR ALIGN=CENTER><TD>off</TD><TD>on</TD></TR>
<TR ALIGN=CENTER><TD>on</TD><TD>on</TD></TR></TABLE>
</TD></TR></TABLE>
</TD></TR>

<TR VALIGN=TOP><TD>K</TD><TD>1</TD><TD>(3)</TD>
<TD>Copyright<BR>          
0 - Audio is not copyrighted<BR>
1 - Audio is copyrighted</TD>
</TR>

<TR VALIGN=TOP><TD>L</TD><TD>1</TD><TD>(2)</TD>
<TD>Original<BR>          
0 - Copy of original media<BR>
1 - Original media</TD>
</TR>

<TR VALIGN=TOP>
<TD>M</TD><TD>2</TD><TD>(1,0)</TD>
<TD>Emphasis<BR>          
00 - none<BR>
01 - 50/15 ms<BR>
10 - reserved<BR>
11 - CCIT J.17</TD>
</TR></TABLE>
<P>&nbsp;</P></CENTER>

<P ALIGN="center"><A NAME="MPEGTAG"></A><FONT SIZE="5"><B>MPEG Audio Tag ID3v1</B></FONT> 
<P>The TAG is used to describe the MPEG Audio file. It contains information
about artist, title, album, publishing year and genre. There is some extra
space for comments. It is exactly 128 bytes long and is located at very end of
the audio data. You can get it by reading the last 128 bytes of the MPEG audio
file.

<P ALIGN="center"><FONT SIZE="5"><B><TT>
AAABBBBB BBBBBBBB BBBBBBBB BBBBBBBB<BR>
BCCCCCCC CCCCCCCC CCCCCCCC CCCCCCCD<BR>
DDDDDDDD DDDDDDDD DDDDDDDD DDDDDEEE<BR>
EFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFG<BR>
</TT></B></FONT>

<CENTER>

<TABLE BORDER="0" WIDTH="500">
<TR VALIGN=TOP BGCOLOR=#E2E2E2>
<TD>Sign</TD><TD>Length<BR>(bytes)</TD><TD>Position<BR>
(bytes)</TD><TD>Description</TD></TR>
<TR VALIGN=TOP><TD>A</TD><TD>3</TD><TD>(0-2)</TD>
<TD>Tag identification. Must contain 'TAG' if tag exists and is 
correct.</TD>
</TR>
<TR><TD>B</TD><TD>30</TD><TD>(3-32)</TD><TD>Title</TD></TR>
<TR><TD>C</TD><TD>30</TD><TD>(33-62)</TD><TD>Artist</TD></TR>
<TR><TD>D</TD><TD>30</TD><TD>(63-92)</TD><TD>Album</TD></TR>
<TR><TD>E</TD><TD>4</TD><TD>(93-96)</TD><TD>Year</TD></TR>
<TR><TD>F</TD><TD>30</TD><TD>(97-126)</TD><TD>Comment</TD></TR>
<TR><TD>G</TD><TD>1</TD><TD>(127)</TD><TD>Genre</TD></TR></TABLE>
</CENTER>

<P>The specification asks for all fields to be padded with null character
(ASCII 0). However, not all applications respect this (an example is WinAmp
which pads fields with &lt;space&gt;, ASCII 32).

<P>There is a small change proposed in <B>ID3v1.1</B> structure. The last byte 
of the Comment field may be used to specify the track number of a song in an 
album. It should contain a null character (ASCII 0) if the information is 
unknown.

<P>Genre is a numeric field which may have one of the following values:

<CENTER>
<TABLE BORDER="0" WIDTH="90%">
<TR>
<TD WIDTH="1%">0</TD>
<TD WIDTH="20%">'Blues'</TD>
<TD WIDTH="1%">20</TD>
<TD WIDTH="20%">'Alternative'</TD>
<TD WIDTH="1%">40</TD>
<TD WIDTH="20%">'AlternRock'</TD>
<TD WIDTH="1%">60</TD>
<TD WIDTH="20%">'Top 40'</TD>
</TR>
<TR>
<TD>1</TD>
<TD>'Classic Rock'</TD>
<TD>21</TD>
<TD>'Ska'</TD>
<TD>41</TD>
<TD>'Bass'</TD>
<TD>61</TD>
<TD>'Christian Rap'</TD>
</TR>
<TR>
<TD>2</TD>
<TD>'Country'</TD>
<TD>22</TD>
<TD>'Death Metal'</TD>
<TD>42</TD>
<TD>'Soul'</TD>
<TD>62</TD>
<TD>'Pop/Funk'</TD>
</TR>
<TR>
<TD>3</TD>
<TD>'Dance'</TD>
<TD>23</TD>
<TD>'Pranks'</TD>
<TD>43</TD>
<TD>'Punk'</TD>
<TD>63</TD>
<TD>'Jungle'</TD>
</TR>
<TR>
<TD>4</TD>
<TD>'Disco'</TD>
<TD>24</TD>
<TD>'Soundtrack'</TD>
<TD>44</TD>
<TD>'Space'</TD>
<TD>64</TD>
<TD>'Native American'</TD>
</TR>
<TR>
<TD>5</TD>
<TD>'Funk'</TD>
<TD>25</TD>
<TD>'Euro-Techno'</TD>
<TD>45</TD>
<TD>'Meditative'</TD>
<TD>65</TD>
<TD>'Cabaret'</TD>
</TR>
<TR>
<TD>6</TD>
<TD>'Grunge'</TD>
<TD>26</TD>
<TD>'Ambient'</TD>
<TD>46</TD>
<TD>'Instrumental Pop'</TD>
<TD>66</TD>
<TD>'New Wave'</TD>
</TR>
<TR>
<TD>7</TD>
<TD>'Hip-Hop'</TD>
<TD>27</TD>
<TD>'Trip-Hop'</TD>
<TD>47</TD>
<TD>'Instrumental Rock'</TD>
<TD>67</TD>
<TD>'Psychadelic'</TD>
</TR>
<TR>
<TD>8</TD>
<TD>'Jazz'</TD>
<TD>28</TD>
<TD>'Vocal'</TD>
<TD>48</TD>
<TD>'Ethnic'</TD>
<TD>68</TD>
<TD>'Rave'</TD>
</TR>
<TR>
<TD>9</TD>
<TD>'Metal'</TD>
<TD>29</TD>
<TD>'Jazz+Funk'</TD>
<TD>49</TD>
<TD>'Gothic'</TD>
<TD>69</TD>
<TD>'Showtunes'</TD>
</TR>
<TR>
<TD>10</TD>
<TD>'New Age'</TD>
<TD>30</TD>
<TD>'Fusion'</TD>
<TD>50</TD>
<TD>'Darkwave'</TD>
<TD>70</TD>
<TD>'Trailer'</TD>
</TR>
<TR>
<TD>11</TD>
<TD>'Oldies'</TD>
<TD>31</TD>
<TD>'Trance'</TD>
<TD>51</TD>
<TD>'Techno-Industrial'</TD>
<TD>71</TD>
<TD>'Lo-Fi'</TD>
</TR>
<TR>
<TD>12</TD>
<TD>'Other'</TD>
<TD>32</TD>
<TD>'Classical'</TD>
<TD>52</TD>
<TD>'Electronic'</TD>
<TD>72</TD>
<TD>'Tribal'</TD>
</TR>
<TR>
<TD>13</TD>
<TD>'Pop'</TD>
<TD>33</TD>
<TD>'Instrumental'</TD>
<TD>53</TD>
<TD>'Pop-Folk'</TD>
<TD>73</TD>
<TD>'Acid Punk'</TD>
</TR>
<TR>
<TD>14</TD>
<TD>'R&amp;B'</TD>
<TD>34</TD>
<TD>'Acid'</TD>
<TD>54</TD>
<TD>'Eurodance'</TD>
<TD>74</TD>
<TD>'Acid Jazz'</TD>
</TR>
<TR>
<TD>15</TD>
<TD>'Rap'</TD>
<TD>35</TD>
<TD>'House'</TD>
<TD>55</TD>
<TD>'Dream'</TD>
<TD>75</TD>
<TD>'Polka'</TD>
</TR>
<TR>
<TD>16</TD>
<TD>'Reggae'</TD>
<TD>36</TD>
<TD>'Game'</TD>
<TD>56</TD>
<TD>'Southern Rock'</TD>
<TD>76</TD>
<TD>'Retro'</TD>
</TR>
<TR>
<TD>17</TD>
<TD>'Rock'</TD>
<TD>37</TD>
<TD>'Sound Clip'</TD>
<TD>57</TD>
<TD>'Comedy'</TD>
<TD>77</TD>
<TD>'Musical'</TD>
</TR>
<TR>
<TD>18</TD>
<TD>'Techno'</TD>
<TD>38</TD>
<TD>'Gospel'</TD>
<TD>58</TD>
<TD>'Cult'</TD>
<TD>78</TD>
<TD>'Rock &amp; Roll'</TD>
</TR>
<TR>
<TD>19</TD>
<TD>'Industrial'</TD>
<TD>39</TD>
<TD>'Noise'</TD>
<TD>59</TD>
<TD>'Gangsta'</TD>
<TD>79</TD>
<TD>'Hard Rock'</TD>
</TR>
</TABLE>
<DIV ALIGN="LEFT"><BR>
WinAmp expanded this table with next codes: </DIV>
<TABLE BORDER="0" WIDTH="90%">
<TR> 
<TD WIDTH="1%">80</TD>
<TD WIDTH="20%">'Folk'</TD>
<TD>92</TD>
<TD>'Progressive Rock'</TD>
<TD>104</TD>
<TD>'Chamber Music'</TD>
<TD>116</TD>
<TD>'Ballad'</TD>
</TR>
<TR> 
<TD>81</TD>
<TD>'Folk-Rock'</TD>
<TD WIDTH="1%">93</TD>
<TD WIDTH="20%">'Psychedelic Rock'</TD>
<TD>105</TD>
<TD>'Sonata'</TD>
<TD>117</TD>
<TD>'Poweer Ballad'</TD>
</TR>
<TR> 
<TD>82</TD>
<TD>'National Folk'</TD>
<TD>94</TD>
<TD>'Symphonic Rock'</TD>
<TD WIDTH="1%">106</TD>
<TD WIDTH="20%">'Symphony'</TD>
<TD>118</TD>
<TD>'Rhytmic Soul'</TD>
</TR>
<TR> 
<TD>83</TD>
<TD>'Swing'</TD>
<TD>95</TD>
<TD>'Slow Rock'</TD>
<TD>107</TD>
<TD>'Booty Brass'</TD>
<TD WIDTH="1%">119</TD>
<TD WIDTH="20%">'Freestyle'</TD>
</TR>
<TR> 
<TD>84</TD>
<TD>'Fast Fusion'</TD>
<TD>96</TD>
<TD>'Big Band'</TD>
<TD>108</TD>
<TD>'Primus'</TD>
<TD>120</TD>
<TD>'Duet'</TD>
</TR>
<TR> 
<TD>85</TD>
<TD>'Bebob'</TD>
<TD>97</TD>
<TD>'Chorus'</TD>
<TD>109</TD>
<TD>'Porn Groove'</TD>
<TD>121</TD>
<TD>'Punk Rock'</TD>
</TR>
<TR> 
<TD>86</TD>
<TD>'Latin'</TD>
<TD>98</TD>
<TD>'Easy Listening'</TD>
<TD>110</TD>
<TD>'Satire'</TD>
<TD>122</TD>
<TD>'Drum Solo'</TD>
</TR>
<TR> 
<TD>87</TD>
<TD>'Revival'</TD>
<TD>99</TD>
<TD>'Acoustic'</TD>
<TD>111</TD>
<TD>'Slow Jam'</TD>
<TD>123</TD>
<TD>'A Capela'</TD>
</TR>
<TR> 
<TD>88</TD>
<TD>'Celtic'</TD>
<TD>100</TD>
<TD>'Humour'</TD>
<TD>112</TD>
<TD>'Club'</TD>
<TD>124</TD>
<TD>'Euro-House'</TD>
</TR>
<TR> 
<TD>89</TD>
<TD>'Bluegrass'</TD>
<TD>101</TD>
<TD>'Speech'</TD>
<TD>113</TD>
<TD>'Tango'</TD>
<TD>125</TD>
<TD>'Dance Hall'</TD>
</TR>
<TR> 
<TD>90</TD>
<TD>'Avantgarde'</TD>
<TD>102</TD>
<TD>'Chanson'</TD>
<TD>114</TD>
<TD>'Samba'</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
</TR>
<TR> 
<TD>91</TD>
<TD>'Gothic Rock'</TD>
<TD>103</TD>
<TD>'Opera'</TD>
<TD>115</TD>
<TD>'Folklore'</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
</TR>
<TR> 
<TD COLSPAN=8>Any other value should be considered as 'Unknown' 
</TABLE>
<P>&nbsp;</P></CENTER>

<P ALIGN="center"><A NAME="MPEG TAG"></A><FONT SIZE="5"><B>MPEG Audio Tag ID3v2</B></FONT> 
<P>This is new proposed TAG format which is different than ID3v1 and ID3v1.1. 
Complete tech specs for it may be found at <A 
HREF="http://www.id3.org/">http://www.id3.org/</A>. 
<P><CENTER>
<HR>
<P><FONT SIZE="-1"> Created on September 1998. by <A HREF="http://www.dv.co.yu/broker/">Predrag 
Supurovic</A>.<BR>
Thanks to <A HREF="http://www.jps.net/kyunghi/">Jean</A> for debugging and polishing 
of this document, <A HREF="http://members.tripod.com/~videoripper/home.htm">Peter 
Luijer</A>, Guwani, Rob Leslie and Franc Zijderveld<BR>
for valuable comments and corrections.</FONT></P>
<P>&copy; 1998, 1999 Copyright by DataVoyage</P>
<P><FONT SIZE="-1">This document may be changed. Check <A
HREF="http://www.dv.co.yu/mpgscript/mpeghdr.htm">http://www.dv.co.yu/mpgscript/mpeghdr.htm</A> 
for updates.<BR>
You may use it freely. Distribution is allowed only in unaltered form. If you 
can help me make it more accurate, please do. </FONT></P>
<P>&nbsp;</P>
</CENTER>

#include "foot.t"