GP2X Detecting Vbr In An Mp3


craigix

Mega GP Mania
Joined
Feb 3, 2003
Messages
11,008
Location
England
Website
twitter.com
Does anyone know a fool proof way of detecting a bitrate of VBR in an MP3 file? Documentation online seems to be hard to find. I did find a doc a while ago explaining that VBR files should contain the track length in the header, this would seem to be the key to detecting them, but I've searched on google for that doc for the last hour and I just can't find it.

Anyone point me in the right direction?

Thanks,

Craig
 
Thanks for the link i'll take a look.

After some more playing about I seem to have found that all my VBR files have the word 'Xing' in the header. This seems to be a standard, could some people do a search on their own VBR files and see if this is the case?
 
There is _usually_ a tag at the beginning (probably the xing thing you found), but it's never guaranteed to be there. The only foolproof way to find if something is VBR (and to find the song length) is by scanning every frame.

If you want a reasonable way that will catch almost all of these screwy files, assume that if it has a vbr tag, the tag is correct. If it doesn't have a VBR tag, scan a portion of the file (make sure to get beginning and end - sometimes different files are grafted together) - if you find different sized frames, then assume it's untagged VBR and scan the whole file to determine the characteristics (maybe generate and cache what would be the tag to allow easier seeking within the file).
 
Another note... there can even be very strange things like switching sample rate or stereo/mono within a file, but I'm not sure it's reasonable to expect that a player handles this correctly.
 
Back
Top