View Full Version : VBR MP3 reencoding - bitrate overhead
Livesms
10th October 2006, 15:49
I wondered is it possible to restrict Lame MP3 encoder from bitrate wasting when reencoding MP3 audio with VBR.
For example. I have MP3 audio file with CBR 320kbit/s.
Reencode with VBR 5 will give me 137.8kbit/s for average bitrate.
lame --vbr-new -V 5 -m j -q 0 --priority 0 audio.avs.wav audio.mp3
32 [ 93] %*
40 [ 0]
48 [ 1] *
56 [ 0]
64 [ 1] *
80 [ 12] *
96 [ 388] *******
112 [1751] %*******************************
128 [2942] %%%**************************************************
160 [3819] %%%%%%%%%***********************************************************
192 [ 238] %****
224 [ 31] %
256 [ 2] %
320 [ 0]
-------------------------------------------------------------------------------
kbps LR MS % long switch short %
137.8 6.8 93.2 95.6 2.7 1.7
Than. If I reencode this audio thrack with CBR for 192, 160, 128, 96 and 80 kbit/s, and then try to encode it with the same VBR 5, I will get smth like this:
CBR 192kbit/s -> VBR 5 - 138.6kbit/s
CBR 160kbit/s -> VBR 5 - 137.0kbit/s
CBR 128kbit/s -> VBR 5 - 130.1kbit/s
CBR 96 kbit/s -> VBR 5 - 110.2kbit/s
CBR 80 kbit/s -> VBR 5 - 105.0kbit/s
So - if CBR file was encoded with bitrate of <=128kbit/s Lame will waste space, encoding low quality sound with higher bitrate. Is it possible to prevent. Auto detect max usefull bitrate, and limit encoder with it.
Kurtnoise
10th October 2006, 16:33
You can restrict min/max bitrate values regarding VBR transcode (-b for the min & -B for the max).
edit: in your 1st command line, joint stereo is not needed and -q 0 not really interesting...
Mug Funky
11th October 2006, 04:47
if the files are already small, don't re-encode them. you can only lose quality, even at the highest allowable bitrates.
lossy->lossy transcoding introduces more losses than one might assume, because of the nature of perception based lossy coding - all the noise is put in the parts you wont hear, but on a re-encode noise will be added in the same spots, only this time the added noise exceeds the threshold of hearing and suddenly the file sounds terrible.
[edit]
you can always re-rip and encode off fresh wav files :)
Livesms
11th October 2006, 06:29
if the files are already small, don't re-encode them. you can only lose quality, even at the highest allowable bitrates.
lossy->lossy transcoding introduces more losses than one might assume, because of the nature of perception based lossy coding - all the noise is put in the parts you wont hear, but on a re-encode noise will be added in the same spots, only this time the added noise exceeds the threshold of hearing and suddenly the file sounds terrible.
[edit]
you can always re-rip and encode off fresh wav files :)
Reencode is need if audio pass thruog Avisynth (fadein, fadeout, dissolve), and output is uncompressed. So I need to compress it again. But if source MP3 was 96kbit, for example, and I will encode it again with -VBR 5 I will get 110.2kbit/s. It is not right.
You can restrict min/max bitrate values regarding VBR transcode (-b for the min & -B for the max).
'Hard' bitrate limitation is not automatic/batch processing. How can I found you was it max 80 or 160 kbit in Avisynth output.
edit: in your 1st command line, joint stereo is not needed and -q 0 not really interesting...
Why? And if it will be Stereo input file? Why not -q 0? Slow? Or no sence in quality in harm of speed? What can you recommend?
Kurtnoise
11th October 2006, 09:33
'Hard' bitrate limitation is not automatic/batch processing. How can I found you was it max 80 or 160 kbit in Avisynth output.
Well I don't know but Lame produces some statistics...Otherwise, have a look at the Lame encoder 2pass (http://kkkkk.net/?key=soft.l2ae).
Why? And it it will be Stereo input file?
Yes, Joint Stereo is the default mode for stereo sources.
Why not -q 0? Slow? Or no sence in quality in harm of speed?
because it's useless with your command line...
What can you recommend?
Well, as Mug Funky said a lossy-to-lossy process is not really recommended. But, --vbr-new -V 5 is fine...
Livesms
11th October 2006, 09:49
Well I don't know but Lame produces some statistics...
Yes. Lame produces some statistics. But in my case it is only statistics. I can't see any way to
1. Found out bitrate of MP3, after it was uncompressed back to WAV
2. Auto set this bitrate to Lame, because I see no sence in encoding PCM WAV, produced from 96kbit/s MP3 with VBR for 110kbit/s.
Yes, Joint Stereo is the default mode for stereo sources.
Ok. I'll check/test this.
because it's (-q 0) useless with your command line...
Why? And what max -q will be usefull?
Well, as Mug Funky said a lossy-to-lossy process is not really recommended. But, --vbr-new -V 5 is fine...
--vbr-new -V 5. But the same problem with useless bitrate waste if input MP3/WAV was encoded with lower bitrate then VBR produce.
Mug Funky
11th October 2006, 10:11
well, you could either let LAME give you ~110 kbps, or force CBR :)
the encoder isn't aware that the input is decoded 96kbps, because to it it just looks like lowpassed audio with quite a bit of near silence in several bands. that's why you're not getting the ~200 kbps typical of -V 5 - because there's less there to encode. but it'll still err on the side of caution when allocating bitrate.
of course, if you can spare the space, you could leave the audio as PCM :)
it's theoretically possible to write a batch file smart enough to get the average bitrate via the shell output of some program (say mplayer), then use that in the LAME commandline as an ABR bitrate. but quality would be even worse (1-pass ABR isn't as nice as 1-pass quality based VBR).
it's too bad we can't split the mp3 into pieces that correspond to the avisynth edits, and only re-encode the parts that have changed (similar to what NLE programs do with DV footage).
GodofaGap
11th October 2006, 14:48
that's why you're not getting the ~200 kbps typical of -V 5
200 kbps isn't typical for V5.
`Reencode is need if audio pass thruog Avisynth (fadein, fadeout, dissolve), and output is uncompressed. So I need to compress it again. But if source MP3 was 96kbit, for example, and I will encode it again with -VBR 5 I will get 110.2kbit/s. It is not right.
Your question is not right. :)
Input and output bitrate are completely unrelated. There is no reason to assume that getting a 96 kbps file out of a 80 kbps file is a 'waste' of space. MP3 compression doesn't quite work like that.
gameplaya15143
12th October 2006, 01:43
Want a lower bitrate? use a lower quality vbr setting!
ie. -V 7 or even -V 9
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.