Within an MPEG audio file, there is no main header, as an MPEG audio file is just built up from a succession of smaller parts called frames. Each frame is a datablock with its own header and audio information.In the case of Layer I or Layer II, frames are totally independent from each other, so you can cut any part of an MPEG audio file and play it correctly. The player will then play the music starting from the first full valid frame it will find. However, in the case of Layer III, frames are not always independant. Due to the possible use of the "byte reservoir", wich is a kind of internal buffer, frames are often dependent of each other. In the worst case, 9 input frames may be needed before beeing able to decode one single frame.
If you need to retrieve information about an MPEG audio file, you might simply locate the first frame, and retrieve information from its header. Information within other frames should be consistent with the first one, except for the bitrate, as you might be retrieving information from a variable bitrate (VBR) file. In a VBR file, the bitrate can be changed in each frame. It can be used, as an exemple, to keep a constant sound quality during the whole file, by using more bits when the music is more complex and thus requires more bits to be encoded with a similar quality.
The frame header itself is 32 bits (4 bytes) length. The first twelve bits (or first eleven bits in the case of the MPEG 2.5 extension) of a frame header are always set to 1 and are called "frame sync". Frames may also feature an optional CRC checksum. It is 16 bits long and, if it exists, immediately follows the frame header. After the CRC comes the audio data. By re-calculating the CRC and comparing its value to the sored one, you can check if the frame has been altered during transmission of the bitstream.
Here are the details of what is within a frame header:
AAAAAAAA AAABBCCD EEEEFFGH IIJJKLMM
|A||11||(31-21)||Frame sync (all bits must be set)|
|B||2||(20,19)||MPEG Audio version ID|
00 - MPEG Version 2.5 (later extension of MPEG 2)
01 - reserved
10 - MPEG Version 2 (ISO/IEC 13818-3)
11 - MPEG Version 1 (ISO/IEC 11172-3)
Note: MPEG Version 2.5 was added lately to the MPEG 2 standard. It is an extension used for very low bitrate files, allowing the use of lower sampling frequencies. If your decoder does not support this extension, it is recommended for you to use 12 bits for synchronization instead of 11 bits.
00 - reserved
01 - Layer III
10 - Layer II
11 - Layer I
0 - Protected by CRC (16bit CRC follows header)
1 - Not protected
NOTES: All values are in kbps
MPEG files may feature variable bitrate (VBR). Each frame may then be created with a different bitrate. It may be used in all layers. Layer III decoders must support this method. Layer I & II decoders may support it.
For Layer II there are some combinations of bitrate and mode which are not allowed. Here is a list of allowed combinations.
|F||2||(11,10)||Sampling rate frequency index |
0 - frame is not padded
1 - frame is padded with one extra slot
Padding is used to exactly fit the bitrate.As an example: 128kbps 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.
|H||1||(8)||Private bit. This one is only informative.|
00 - Stereo
01 - Joint stereo (Stereo)
10 - Dual channel (2 mono channels)
11 - Single channel (Mono)
Note: Dual channel files are made of two independant mono channel. Each one uses exactly half the bitrate of the file. Most decoders output them as stereo, but it might not always be the case.
One example of use would be some speech in two different languages carried in the same bitstream, and then an appropriate decoder would decode only the choosen language.
|J||2||(5,4)||Mode extension (Only used in Joint stereo) |
Mode extension is used to join informations that are of no use for stereo effect, thus reducing needed bits. These bits are dynamically determined by an encoder in Joint stereo mode, and Joint Stereo can be changed from one frame to another, or even switched on or off.
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 algorithm.
0 - Audio is not copyrighted
1 - Audio is copyrighted
The copyright has the same meaning as the copyright bit on CDs and DAT tapes, i.e. telling that it is illegal to copy the contents if the bit is set.
0 - Copy of original media
1 - Original media
The original bit indicates, if it is set, that the frame is located on its original media.
00 - none
01 - 50/15 ms
10 - reserved
11 - CCIT J.17
The emphasis indication is here to tell the decoder that the file must be de-emphasized, ie the decoder must 're-equalize' the sound after a Dolby-like noise supression. It is rarely used.
Audio file formats
MPEG-1 Audio Layer 3
Internet media type
Bangin' Tunes M8
File formats category - v • e edit
Wikipedia has an article related to:
MPEG-1 Audio Layer 3, referred to as MP3, is a digital audio encoding format using a form of lossy data compression. It is a common audio format for consumer audio storage, as well as a de facto standard encoding for the transfer and playback of music on digital audio players. MP3 is an audio-specific format that was designed by the Moving Picture Experts Group. It was approved as an ISO/IEC standard in 1991.
The use in MP3 of a lossy compression algorithm is designed to greatly reduce the amount of data required to represent the audio recording and still sound like a faithful reproduction of the original uncompressed audio for most listeners, but is not considered high fidelityaudio by audiophiles. An MP3 file that is created using the mid-range bit ratesetting of 128 kbit/s will result in a file that is typically about 1/10th the size of the CD file created from the original audio source. An MP3 file can also be constructed at higher or lower bit rates, with higher or lower resulting quality. The compression works by reducing accuracy of certain parts of sound that are deemed beyond the auditory resolution ability of most people. This method is commonly referred to as perceptual coding. It internally provides a representation of sound within a short term time/frequency analysis window, by using psychoacoustic models to discard or reduce precision of components less audible to human hearing, and recording the remaining information in an efficient manner. This is relatively similar to the principles used by JPEG, an image compression format.
Encoding audio Edit
The MPEG-1 standard does not include a precise specification for an MP3 encoder, but does provide example psychoacoustic models, rate loop, and the like in the non-normative part of the original standard. At the present, these suggested implementations are quite dated. Implementers of the standard were supposed to devise their own algorithms suitable for removing parts of the information in the raw audio (or rather its MDCT representation in the frequency domain). During encoding, 576 time-domain samples are taken and are transformed to 576 frequency-domain samples. If there is a transient, 192 samples are taken instead of 576. This is done to limit the temporal spread of quantization noise accompanying the transient. (See psychoacoustics.)
As a result, there are many different MP3 encoders available, each producing files of differing quality. Comparisons are widely available, so it is easy for a prospective user of an encoder to research the best choice. It must be kept in mind that an encoder that is proficient at encoding at higher bit rates (such as LAME) is not necessarily as good at lower bit rates.
Decoding, on the other hand, is carefully defined in the standard. Most decoders are "bitstream compliant", which means that the decompressed output - that they produce from a given MP3 file - will be the same (within a specified degree of rounding tolerance) as the output specified mathematically in the ISO/IEC standard document (ISO/IEC 11172-3).
The MP3 file has a standard format, which is a frame that consists of 384, 576, or 1152 samples (depends on MPEG version and layer), and all the frames have associated header information (32 bits) and side information (9, 17, or 32 bytes, depending on MPEG version and stereo/mono). The header and side information help the decoder to decode the associated Huffman encoded data correctly.
Therefore, comparison of decoders is usually basefewfwefed on how computationally efficient they are (i.e., how much memory or CPU time they use in the decoding process).
Audio quality Edit
When performing lossy audio encoding, such as creating an MP3 file, there is a trade-off between the amount of space used and the sound quality of the result. Typically, the creator is allowed to set a bit rate, which specifies how many kilobits the file may use per second of audio, as in when ripping a compact disc to MP3 format. Using a lower bit rate provides a relatively lower audio quality and produces a smaller file size. Likewise, using a higher bit rate outputs a higher quality audio, but also results in a larger file.
Files encoded with a lower bit rate will generally play back at a lower quality. With too low a bit rate, "compression artifacts" (i.e., sounds that were not present in the original recording) may be audible in the reproduction. Some audio is hard to compress because of its randomness and sharp attacks. When this type of audio is compressed, artifacts such as ringing or pre-echo are usually heard. A sample of applause compressed with a relatively low bit rate provides a good example of compression artifacts.
Besides the bit rate of an encoded piece of audio, the quality of MP3 files also depends on the quality of the encoder itself, and the difficulty of the signal being encoded. As the MP3 standard allows quite a bit of freedom with encoding algorithms, different encoders may feature quite different quality, even with identical bit rates.
The simplest type of MP3 file uses one bit rate for the entire file — this is known as constant bitrate (CBR) encoding. Using a constant bit rate makes encoding simpler and faster. However, it is also possible to create files where the bit rate changes throughout the file. These are known as variable bitrate (VBR) files. The idea behind this is that, in any piece of audio, some parts will be much easier to compress, such as silence or music containing only a few instruments, while others will be more difficult to compress. So, the overall quality of the file may be increased by using a lower bit rate for the less complex passages and a higher one for the more complex parts. With some encoders, it is possible to specify a given quality, and the encoder will vary the bit rate accordingly. Users who know a particular "quality setting" that is transparent to their ears can use this value when encoding all of their music, and not need to worry about performing personal listening tests on each piece of music to determine the correct bit rate.
In a listening test, MP3 encoders at low bit rates performed significantly worse than those using more modern compression methods (such as AAC).
Perceived quality can be influenced by listening environment (ambient noise), listener attention, and listener training and in most cases by listener audio equipment (such as sound cards, speakers and headphones). Banging Tune here:
Several bit rates are specified in the MPEG-1 Layer 3 standard: 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 192, 224, 256 and 320 kbit/s, and the available sampling frequencies are 32, 44.1 and 48 kHz. A sample rate of 44.1 kHz is almost always used, because this is also used for CD audio, the main source used for creating MP3 files. A greater variety of bit rates are used on the Internet. 128 kbit/s is the most common, because it typically offers adequate audio quality in a relatively small space. 192 kbit/s is often used by those who notice artifacts at lower bit rates. As the Internet bandwidth availability and hard drive sizes have increased, 128 kbit/s bit rate files are slowly being replaced with higher bit rates like 192 kbit/s, with some being encoded up to MP3's maximum of 320 kbit/s. It is unlikely that higher bit rates will be popular with any lossy audio codec because file sizes at higher bit rates approach those of lossless codecs such as FLAC.
By contrast, uncompressed audio as stored on a compact disc has a bit rate of 1,411.2 kbit/s (16 bit/sample × 44100 samples/second × 2 channels / 1000 bits/kilobit).
Some additional bit rates and sample rates were made available in the MPEG-2 and the (unofficial) MPEG-2.5 standards: bit rates of 8, 16, 24, and 144 kbit/s and sample rates of 8, 11.025, 12, 16, 22.05 and 24 kHz.
Non-standard bit rates up to 640 kbit/s can be achieved with the LAME encoder and the freeformat option, although few MP3 players can play those files. According to the ISO standard, decoders are only required to be able to decode streams up to 320 kbit/s.
An MP3 file is made up of multiple MP3 frames, which consist of a header and a data block. This sequence of frames is called an elementary stream. Frames are not independent items ("byte reservoir") and therefore cannot be extracted on arbitrary frame boundaries. The MP3 Data blocks contain the (compressed) audio information in terms of frequencies and amplitudes. The diagram shows that the MP3 Header consists of a sync word, which is used to identify the beginning of a valid frame. This is followed by a bit indicating that this is the MPEG standard and two bits that indicate that layer 3 is used; hence MPEG-1 Audio Layer 3 or MP3. After this, the values will differ, depending on the MP3 file. ISO/IEC 11172-3 defines the range of values for each section of the header along with the specification of the header. Most MP3 files today contain ID3 metadata, which precedes or follows the MP3 frames; as noted in the diagram.
ID3 and other tagsEdit
Main articles: ID3 and APEv2 tag
A "tag" in an audio file is a section of the file that contains metadata such as the title, artist, album, track number or other information about the file's contents.
As of 2006, the most widespread standard tag formats are ID3v1 and ID3v2, and the more recently introduced APEv2.
APEv2 was originally developed for the MPC file format. APEv2 can coexist with ID3 tags in the same file or it can be used by itself.
Tag editing functionality is often built-in to MP3 players and editors, but there also exist tag editors dedicated to the purpose.
Since volume levels of different audio sources can vary greatly, it is sometimes desirable to adjust the playback volume of audio files such that a consistent average volume is perceived. The idea is to control the average volume across multiple files, not the volume peaks in a single file. This gain normalization, while similar in purpose, is distinct from dynamic range compression (DRC), which is a form of normalization used in audio mastering. Gain normalization may defeat the intent of recording artists and audio engineers who deliberately set the volume levels of the audio they recorded.
Main article: List of codecs
Many other lossy and lossless audio codecs exist. Among these, mp3PRO, AAC, and MP2 are all members of the same technological family as MP3 and depend on roughly similar psychoacoustic models. The Fraunhofer Gesellschaft owns many of the basic patents underlying these codecs as well, with others held by Dolby Labs, Sony, Thomson Consumer Electronics, and AT&T. In addition, there is also the open source file format Ogg Vorbisthat has been available free of charge and legal threat thanks to the XIPH Open Source community.
§ Audio compression (data)
§ Comparison of audio codecs
§ Copyright infringement
§ Digital audio player
§ Joint stereo
§ LRC (file format)
§ Media player
§ MP3 blog
§ MP3 Surround
§ Streaming Media
§ DJ digital controller
§ Ogg Vorbis
1. ↑ Jayant, Nikil; Johnston, James; Safranek, Robert (October 1993). "Signal Compression Based on Models of Human Perception". Proceedings of the IEEE81 (10): 1385–1422. doi:10.1109/5.241504.
§ The Story of MP3 — How MP3 was invented, by Fraunhofer IIS
§ Samsung MP3 Player
§ MPEG Official Web site
| Wikipedia has an article related to: |