HydrogenAudio

Lossy Audio Compression => AAC => AAC - Tech => Topic started by: dand on 2011-12-07 16:37:04

Title: CBR or VBR - how to detect?
Post by: dand on 2011-12-07 16:37:04
Hi,
I have an AAC file that is being reported by the "MediaInfo" tool as VBR. How do these tools judge if AAC is CBR or VBR? How is AAC CBR different than AAC VBR, is there a limit in frame size differences accros file?

Thanks...
Title: CBR or VBR - how to detect?
Post by: pratheekp on 2011-12-17 10:48:27
Hi,

    In CBR, constant bit rate mode, each frame is encoded with bits = bit_rate/sampling_rate*frame size. The use of bit reservoir allows a local variation of bits between frames. ie frames which require less bits to encode gives away its bits to encode complex portions of the music, but the bits/ channel cannot  be greater than 6144 bits as per the standard. The left over bits are used as fill bits(zero's) in order to maintain the desired rate. In case of CBR mode, we can correctly find out the file size by calculation.

But in VBR, variable bit rate ,each frame can be encoded with a max of 6144 bits/channel. Here since we do not know what can be the bits used for encoding each frame, we cannot predict the file size. Also in VBR no fill bits are used.

Hope it helps

Regards
Pratheek
Title: CBR or VBR - how to detect?
Post by: dand on 2012-02-03 09:56:51
Hi,
I have an AAC file that is being reported by the "MediaInfo" tool as VBR. How do these tools judge if AAC is CBR or VBR? How is AAC CBR different than AAC VBR, is there a limit in frame size differences accros file?

Thanks...



Ok, here is a code snippet where MediaInfo decides on the bitrate:

Code: [Select]
void File...()
{
        if (FrameSize_Max>FrameSize_Min*1.02)
        {
            Fill(Stream_Audio, 0, Audio_BitRate_Mode, "VBR");
            Fill(Stream_Audio, 0, Audio_BitRate_Minimum, ((float64)FrameSize_Min)/1024*48000*8, 0);
            Fill(Stream_Audio, 0, Audio_BitRate_Maximum, ((float64)FrameSize_Max)/1024*48000*8, 0);
        }
        else if (Config_ParseSpeed>=1.0)
        {
            Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR");
        }
}



Seems like they flag stream as VBR if max frame is more than 2% greater than the min frame.