Hello everybody.
I just decode mp3 files on an ESP32 (only the first frame / vbr frame) to calculate the information such as duration and average kbps etc.
In the vbr files (xing + vbri) I already have the correct calculation.
But with cbr files I still have a problem. I read, for example 320 kbps from the header. Since I save the value in a uint16_t, I do not calculate the bps but calculate ....
(file length / 1024) / (320/8)
File length is 7370235 byte.
So the result is 7197 / 40 = 179 (duration 2:59 min)
But two different Codecs on my PC (VLC + Video Editing) indicate the duration of 3:04 min.
So I checked the calculations again. If i calculate the following, then the duration coincides with the codecs:
(file length / 1000) / (320/8)
So the result is 7370 / 40 = 184 (duration 3:04 min) -> correct
So 320 kbps is not 40 kilo bytes per second? Do the kbps have to be converted with kilo or kibi?