
Talking about some basic differences between VBR and CBR in mp3 files Part 2

The appearance of VBR encoding technology is to solve the problem of this waste of space.
/CBR-vs-VBR-069b3b5e6d554d53841e7e525092d25b.jpg)
VBR technology selects the most suitable bit rate for each audio frame. For audio frames with a lower pitch, the bit rate will be lower and the data size will be smaller. If the pitch is higher, the bit rate will be higher. The size is larger. In this way, the storage space of the audio data can be saved and the size of the mp3 file can be further compressed without losing the audio quality.
The figure above briefly compares the differences in data content between CBR and VBR mp3 files. It can be seen that the bit rate of the VBR encoded mp3 is not necessarily the same due to the difference in data content between frames. Generally, VBR technology will compress and encode in the range of 8~320kbps, so the bit rate of the whole file is higher than that of the whole file. Constant CBR encoding, VBR encoding has a bit rate variable bit rate throughout the file, hence the name VBR (variable bit rate).
In addition to the two encodings CBR and VBR, there is also an ABR (Average Bit Rate, Average Bit Rate) type encoding, which is basically the same as CBR, most audio frames are encoded at the bit rate specified, but they will be The content is encoded with a higher bitrate than specified, but usually this content is short, so there is not much difference in file size compared to CBR, so this type is not common.
Disadvantages of VBR technology compared to CBR technology
Using VBR technology to encode and compress mp3 files can certainly optimize file size, but at the same time, it also brings some new problems in acquiring audio information and monitoring playback progress.
The first is the calculation of the duration of the audio. If it is CBR encoding, since the bit rate is constant, the data size of all audio frames is fixed, so the data size needed to decode for each second of playback is the same, so it is very simple to calculate the audio time length. Just use the following formula:
timelength ( s ) = (total file length (Byte) – total id3 field size (if present)) * 8 / (bitrate (kbps) * 1000 )
In the formula, the id3 field refers to the basic information field that is placed at the beginning or end of the mp3 file, and is generally used to record the audio file name, singer name, and album name. The id3 is divided into two versions, v1 and v2, and v1 only registers. The above three types of information, and the size is fixed, are usually placed at the end of the file; v2 is more flexible than v1, the type of the recorded information is not limited to the above three, and the size is not fixed, it is usually placed at the beginning of the file. The id3 field is an optional field, and the mp3 file doesn’t necessarily have it, so to calculate the audio time of the mp3, you must first read it to see if the id3 exists.



