I know of many utilities that can tell me the bitrate of an MP3 file, but I've never seen one that can tell me whether or not the MP3 file is VBR (variable bit rate - the bit rate fluctuates within the file) or a CBR (constant bit rate - the bit rate stays the same within the file). My guess is that most programs aren't interested in finding this out since it involves analyzing the file somewhat to see if the bitrate changes, which takes away from speed.
So, in lieu of finding a utility, I'd like to write one - so how could I programmatically determine whether or not an MP3 file is VBR or CBR? I have about 15,000 files to go through to find this out for, so I need to automate the process.
MP3 files are essentially build of so called frames. Each frame has a small header that stores information about the frame. The header also stores which bitrate was used for the frame. In CBR files, all frames use the same bitrate and therefore every header has the same bitrate information.
To detect if a file uses VBR, you have to go through every frame of the file, look at the header and check if the bitrate field changes. If it does, its an VBR MP3.
A full description of the MP3 format is here: http://www.mpgedit.org/mpgedit/mpeg_format/mpeghdr.htm
Check this MP3Header Class, it has a method that tells you if the mp3 file is VBR, and all the mp3 header information...
...
boolVBitRate = LoadVBRHeader(bytVBitRate);
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With