
How does an mp3 file work?
![]()
What is the structure of an mp3?

An MP3 song has three
versions: 96 Kbps (96 kilobits per second), 128 Kbps and 192 Kbps. Kbps (bit rate), which indicates the amount of music data per second,
the higher the Kbps value, the better the sound quality, and the larger the file, the MP3 standard stipulates that an MP3 file with a constant bit rate is called CBR, and most of the
MP3 files are CBR, and MP3 file with changing bit rate is called VBR, and the length of each FRAME can be changed. The following are
the differences between CBR and VBR:
1) CBR: The size of the FRAME with a fixed bitrate is fixed (the formula is as above), as long as the total length of the file and the length of the frame are known, mp3 can be calculated from the 26ms needed to play each frame. The total playback time can also be monitored by counting the number of frames to control operations such as fast forward, fast rewind, and slow playback. Note: Sometimes not all frames are the same length and some frames may be one or more bytes longer.
2) VBR: VBR is an algorithm released by XING company, so there will be “XING” keyword in the MP3 FRAME (many popular
Small software can also perform VBR compression (it is not known if they comply with this agreement), it is stored in the first valid FRAME in the MP3 file and identifies that the MP3 file is VBR. At the same time, the first FRAME stores the total number of FRAMES of the MP3 file, which makes it easy to get the total playing time, and at the same time, there are 100 bytes to store the FRAME INDEX of 100 times segments of the total playing time. . Suppose a 4 minute MP3 song 240S is divided into 100 segments, and the time difference between two adjacent INDEXes is 2.4S, so through this INDEX as long as some FRAMES are processed before and then we can quickly find the FRAME header we need to fast forward. Table 2 Explanation of the byte of
structure of the first frame of the VBR 1-4 file The same standard sound frame header as CBR 5-40 Save the VBR file logo “Xing” (58 69 6E 67), the specific location of this logo depends on the adopted standard MPEG and the sound depends on the channel mode. The leading and trailing bytes of the flag are not used. 36-39 MPEG-1 and non-mono (common) 21-24 MPEG-1 and mono 21-24 MPEG-2 and non-mono 13-16 MPEG-2 and mono 41-44 Flags, indicates whether the frame number, Se stores information about file length, directory table, and VBR scale, and if so, 01 02 04 08. 45-48 frame number (including first frame) 49-52 file length 53-152 file table directory, used for byte positioning according to time. 153-156 VBR scale for bit rate changes



