
mp3 audio format, the most popular
![]()
With the rapid development of file compression technology, MP3 has become the most popular music format today.
![]()
MP3 File Format Analysis MP3 file data is made up of multiple frames, and the frame is the smallest unit of the MP3 file. Each frame consists of a frame header, additional information, and sound data. The playback time of each frame is 0.026 seconds, and its duration varies with the bit rate. Some MP3 files have extra bytes at the end to store description information for non-audio data. The structure of the MP3 file is shown in Figure 2. 3.1 Frame header format The frame header is 4 bytes long. For fixed bitrate MP3 files, the frame header format of all frames is the same. The data structure is as follows: typedef FrameHeader{ unsigned int sync:11;//Sync information unsigned int version:2 ;//version unsigned int layer:2;//layer unsigned int protection:1;//CRC check unsigned int bitrate:4;//unsigned bitrate int frequency:2;//unsigned frequency int padding:1;//unsigned frame length setting int private:1;//unsigned reserved word int mode:2; //unsigned channel mode int mode extension:2;//unsigned extended mode int copyright:1;//unsigned copyright int original:1 ;//unsigned original logo int emphasis:2;//emphasis mode }HEADER, *LPHEADER; See Table 1 for a description of the 4 byte frame header. Table 1 Explanation of the use of MP3 frame header bytes Name Length (bits) Description Synchronization information 11 All bits in the 1st and 2nd byte are 1, and the 1st byte is always FF. Version 200-MPEG 2. 5 01-undefined 10-MPEG 2 11-MPEG 1 layer 2 00-undefined 01-Layer 3 10-Layer 2 11-Layer 1 CRC check 1 0-check 1-no check Bit rate 4 The third bit Tuple sampling rate, the unit is kbps, such as MPEG-1 Layer 3, 64 kbps, the value is 0101. Frequency 2 Sampling frequency, for MPEG-1: 00-44.1 kHz 01-48 kHz 10 -32 kHz 11-setting frame length undefined 1 is used to set the length of the file header, 0-no setting, 1-setting, the specific setting calculation method see below. Reserved word 1 is not used. Channel Mode 2 The fourth byte indicates the channel, 00-Stereo 01-Joint Stereo 10-Dual Channel 11-Mono Expansion Mode 2 Only used when the channel mode is 01. Copyright 1 Whether the file is legal or not, 0-Illegal 1-Original logo legal 1 If original, 0-Not original 1-Original emphasis method 2 Used for classification of sound compensation after noise reduction and compression, which is rarely used and is it may not work in the future. 00-Undefined 01-50/15ms 10-Reserved 11-CCITT J.17 MP3 frame length depends on bit rate and frequency, the calculation formula is: frame length = 144×bit rate∕ frequency+padding For example: bit rate is 64kbps, frequency is 44.1kHz, when padding is 1, frame length is 210 bytes. After the table header there is additional information of variable length. For standard MP3 files, their length is 32 bytes, followed by compressed audio data, which will be decoded when the decoder reads here. For Constant Bit Rate (CBR) MP3 files, not all frames are the same length, and some frames may be one or more bytes longer. There is also Variable Bitrate (VBR) MP3, to minimize the length of MP3 file and ensure sound quality, compared to CBR file, except for the first frame, the rest is the same. The first frame of VBR does not contain audio data and its length is 156 bytes, which is used to store information such as standard audio frame header (4 bytes), VBR file identifier, frame number, number file byte, etc. See table 2 for the description of the structure. Table 2 Description of the first byte of the frame structure of the VBR 1-4 file The same standard sound frame header as CBR 5-40 Store the logo of the VBR file “Xing” (58 69 6E 67), the specific position of this logo depends on the adopted MPEG standard and the sound depends on the channel mode.





