How can I programmatically determine if a MP3 file is CBR or VBR? (preferable to use C #)

I know many utilities that can tell me about the bitrate of an MP3 file, but I have never seen anything that can tell me whether an MP3 file is VBR (variable bit rate - the data rate fluctuates inside the file) or CBR (constant bit rate bits - the bit rate remains unchanged in the file). I assume that most programs are not interested in finding this, since it requires a file analysis to find out if the bitrate is changing, which removes the speed.

So, instead of looking for a utility, I would like to write one - so how could I programmatically determine if the MP3 file is VBR or CBR? I have about 15,000 files to find this, so I need to automate the process.

+5
source share
2 answers

MP3 files essentially consist of so-called frames. Each frame has a small header that stores information about the frame. The header also saves which bitrate was used for the frame. In CBR files, all frames use the same bit, and therefore each header has the same bitrate information.

To determine if a VBR file is using, you need to go through each frame of the file, look at the header and check if the bit rate field is changing. If so, its a VBR MP3.

MP3 : http://www.mpgedit.org/mpgedit/mpeg_format/mpeghdr.htm

+7

MP3Header Class, , , mp3 VBR mp3..

...
boolVBitRate = LoadVBRHeader(bytVBitRate);
...
+2

All Articles