Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: How to check if <64 kbps MP3 is CBR encoded? (Read 5986 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How to check if <64 kbps MP3 is CBR encoded?

Something for the tech guys:


Coming from http://forum.cockos.com/showthread.php?t=52593



My question was
Quote
Also why can't REAPER show "Encoding: CBR" for 8 kbps up to 56 kbps files? Foobar2000 can.

I'm talking about importing a file into REAPER (3.32pre4) and view the Item Source Properties in REAPER. It currently says "Encoding: unknown" for 8 - 56 kbps CBR files.


Reply from the developer:
Quote
I think that below about 64kbps CBR, the mp3 frame size is too small for the mp3 header to fit in, so LAME doesn't write the header.  Maybe foobar does some lower level analysis to see what the encoding is, who knows.




Now my idea and reply was this:
Quote
Can't we just imply "Encoding: CBR" in this case?


If "Encoding: ABR" = false and "Encoding: VBR" = false then "Encoding" = CBR?



MediaInfo also can do it:
Code: [Select]
Format                           : MPEG Audio
File size                        : 960 Bytes
Duration                         : 960ms
Overall bit rate                 : 8 000 bps

Audio
Format                           : MPEG Audio
Format version                   : Version 2
Format profile                   : Layer 3
Format_Settings_Mode             : Joint stereo
Format_Settings_ModeExtension    : MS Stereo
Duration                         : 960ms
Bit rate mode                    : Constant
Bit rate                         : 8 000 bps
Channel(s)                       : 2 channels
Sampling rate                    : 24.0 KHz
Stream size                      : 960 Bytes (100%)




Any hints?

How to check if <64 kbps MP3 is CBR encoded?

Reply #1
It may be true that the LAME header doesn't fit into an MP3 frame that's less than 64 kbps. I haven't checked the source code to verify this.

Anyway, the only reliable way to tell whether an MP3 file is CBR or not is to scan the entire file, extract every single frame header and collect the complete list of frame size (i.e. bitrate) values. Only when all frames are of the same bitrate then the file is "Constant Bit Rate".

The LAME header contains this info when it's present, but it may be incorrect if the mp3 files were modified (trimmed or concatenated) after encoding.

How to check if <64 kbps MP3 is CBR encoded?

Reply #2
Do you know how foobar2000 does it? I doubt that it scans the entire file. But it does display "CBR" for such files!

How to check if <64 kbps MP3 is CBR encoded?

Reply #3
I don't know exactly how foobar2000 identifies MP3 file properties. My guess is:
(1) if the first MP3 frame contains a Xing / LAME or VBRI header then use that info and display "VBR" or "ABR"
(2) if the first MP3 frame contains a LAME Info (CBR) header or no header at all then display "CBR"

see also this thread: Lame And Xing Header Specs

IMO this strategy makes sense because only low bitrate CBR MP3's can't contain a Xing or LAME Info header since there is not enough room to store it. On the other hand, VBR or ABR MP3's of such low bitrates could simply get a first frame that's large enough to store that VBR header.

I think foobar2000 scans the entire file when you use its "Fix MP3 header" feature.

How to check if <64 kbps MP3 is CBR encoded?

Reply #4
I don't know exactly how foobar2000 identifies MP3 file properties. My guess is:
(1) if the first MP3 frame contains a Xing / LAME or VBRI header then use that info and display "VBR" or "ABR"
(2) if the first MP3 frame contains a LAME Info (CBR) header or no header at all then display "CBR"

see also this thread: Lame And Xing Header Specs

IMO this strategy makes sense because only low bitrate CBR MP3's can't contain a Xing or LAME Info header since there is not enough room to store it.


Ok, thanks! That's exactly what I've suggested the REAPER developer to do.

How to check if <64 kbps MP3 is CBR encoded?

Reply #5
FIXED (REAPER 3.36pre2)