Author Topic: How to retrieve played mp3/ogg 's bitrate?  (Read 6092 times)

zajkos

  • Posts: 17
I did'nt find a function to do this. When I compute the bitrate by dividing file lenght by music size in seconds it gives me results which differ from the bitrate showed by winamp ro others programs (for exapmple instead of 128 it gives me 114).

Sebastian_Mares

  • Guest
Re: How to retrieve played mp3/ogg 's bitrate?
« Reply #1 on: 9 Jul '03 - 13:05 »
Yes, this happens because Ogg Vorbis files use VBR encoding (and some of your MP3 files, maybe too). The value you get when dividing the file length by the music duration is the average bitrate.

zajkos

  • Posts: 17
Re: How to retrieve played mp3/ogg 's bitrate?
« Reply #2 on: 9 Jul '03 - 13:26 »
So there is no other way to get the bitrate?

biggyspender

  • Posts: 28
Re: How to retrieve played mp3/ogg 's bitrate?
« Reply #3 on: 9 Jul '03 - 13:36 »

Quote

So there is no other way to get the bitrate?


http://www.dv.co.yu/mpgscript/mpeghdr.htm
http://www.oreilly.com/catalog/mp3/chapter/ch02.html

heavy stuff... enjoy...

(: JOBnik! :)

  • Posts: 1080
Re: How to retrieve played mp3/ogg 's bitrate?
« Reply #4 on: 9 Jul '03 - 13:48 »
Hi ;D

* It's better to get the Bitrate out from the files header :) but here's how to get it other way:

Code: [Select]
// Returns - Kilo Bits Per Second
int GetBitsPerSecond(DWORD handle, DWORD FileLength)
{
 ┬áreturn (int)(((FileLength * 8 ) / (long)BASS_ChannelBytes2Seconds(handle, BASS_StreamGetLength(handle))) / 1000);
}

Have fun!

8) JOBnik! 8)
« Last Edit: 17 Jan '04 - 22:52 by JOBnik »