Log in

View Full Version : Lame MP3 : 320 CBR Joint Stereo / Ms Stereo


sirt
9th March 2013, 21:20
Hi to everybody,

So here I come with another questions dealing with Lame MP3 encoder :) Let's say I want to use 320 CBR encoding.

I have read a couple of things about Joint Stereo and MS Stereo. It seems using Joint Stereo is never a bad idea, which is equal to -m j ; to the contrary, MS stereo should not be used systematically but I don't understand when one decides to use it nor how to set it. I tried -m f but it simply returns an error with both -b 320 -h and --alt-preset insane :

--alt-preset insane --m f --add-id3v2 --ignore-tag-errors --ta "%a" --tt "%t" --tg "%m" --tl "%g" --ty "%y" --tn "%n" %s %d

How could I enable Joint Stereo and MS Stereo at the same time ?

Moreover, the quality is not choosen by me and I generally see -q 2 or -q 3 are used with the above command line. Would it be a good idea to force -q 0 ?

detmek
10th March 2013, 10:46
How could I enable Joint Stereo and MS Stereo at the same time ?
It is enabled by default. LAME encoder automaticly chooses between MS and LR stereo. Do not try to manualy override LAME's decision and force either MS or LR setero. Your choice will not be optimal.
Moreover, the quality is not choosen by me and I generally see -q 2 or -q 3 are used with the above command line. Would it be a good idea to force -q 0 ?
-q 0 is default. Don't change that.

Always use the latest stable version and do not try to learn about LAME and MP3 encoding by reading old articles and forum posts. Things change.

sirt
10th March 2013, 11:49
Thanks detmek, then I deduce everything is somewhat chosen by the encoder without my involvement.

Futhermore, I have another nasty question : let's say I have a 50 MB uncompressed WAV file and I want to recompress it with LAME but the constraint is that I would like to control the final size. Let's say, 10.42 Mb for example. Morever, let's say I want to encode in constant bitrate mode. How could I calculate the necessary bitrate to approximately obtain a 10.42 Mb file ? Do an "Audio Bitrate Calculator" exist ? And which comand-line may I use ? Also, 2 Pass mode ? I don't know if that is possible to do something like this but this would be like "emulating" 2 pass rate control mode of a video codec.

Groucho2004
10th March 2013, 12:10
-q 0 is default
I'm quite certain that q 3 is the default.

sirt
10th March 2013, 12:56
Well but I was pointing out -q parameter is adjusted when using --alt-preset 320 cbr (i.e. 320 cbr compression) and sometimes -q 3 or -q 2 is used by the encoder with this mode. So I why wondering why. I thought -q 0 should always be the best (the lowest) but according to LAME user manual, the encoder chooses the "best" -q to use in 320 cbr mode. But it is paradoxical : doesn't that mean -q 0 is not the best value to use ? And that's why I was asking if I should force -q 0

sneaker_ger
10th March 2013, 13:13
Futhermore, I have another nasty question : let's say I have a 50 MB uncompressed WAV file and I want to recompress it with LAME but the constraint is that I would like to control the final size. Let's say, 10.42 Mb for example. Morever, let's say I want to encode in constant bitrate mode. How could I calculate the necessary bitrate to approximately obtain a 10.42 Mb file ? Do an "Audio Bitrate Calculator" exist ? And which comand-line may I use ? Also, 2 Pass mode ? I don't know if that is possible to do something like this but this would be like "emulating" 2 pass rate control mode of a video codec.

You don't need two passes for constant bitrate. Bitrate calculation is the same as for every other format and doesn't require any special calculators:
filesize / duration = bitrate

detmek
10th March 2013, 13:23
I'm quite certain that q 3 is the default.
http://www.hydrogenaudio.org/forums/index.php?showtopic=98512
I thought they change default q settings. Maybe i red this somewhere else, I can not remmeber now. Though MediaInfo also reports q0 but one can not always trust what MediaInfo reports.

Just found this - http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=97915&view=findpost&p=814480
Thanks detmek, then I deduce everything is somewhat chosen by the encoder without my involvement.

Futhermore, I have another nasty question : let's say I have a 50 MB uncompressed WAV file and I want to recompress it with LAME but the constraint is that I would like to control the final size. Let's say, 10.42 Mb for example. Morever, let's say I want to encode in constant bitrate mode. How could I calculate the necessary bitrate to approximately obtain a 10.42 Mb file ? Do an "Audio Bitrate Calculator" exist ? And which comand-line may I use ? Also, 2 Pass mode ? I don't know if that is possible to do something like this but this would be like "emulating" 2 pass rate control mode of a video codec.
Size of WAV file is not important, but the lenght in seconds. You can calculate it very easy:
Bitrate = Final filesize in kbs / file lenght in seconds

In your example, if audio track comes from DVD, it should have lenght of 266 seconds (+/- few seconds), so:

Bitrate = 10,42*1024*8/266 = 320,90kbs

Since 320kbs is maximum bitrate for MP3 format, you can set 320kbs in command line or GUI you use. If you use command line set -b 320.

Most audio encoders do not have 2-pass mode, so you can not use it. I think WMA and Nero AAC have 2-pass mode but I never saw anyone use it.

pandy
11th March 2013, 11:43
Since 320kbs is maximum bitrate for MP3 format, you can set 320kbs in command line or GUI you use. If you use command line set -b 320.

http://lame.cvs.sourceforge.net/viewvc/lame/lame/doc/html/detailed.html#freeformat
http://mp3decoders.mp3-tech.org/freeformat.html

detmek
11th March 2013, 13:01
Yes, I know about free format. Problem is most decoders do not support free format. How many decoders support it, 3-4?

Not supported by most decoders. Compliant decoders (of which there are few) are only required to support up to 320 kbps.

sirt
11th March 2013, 13:11
detmek, I've noticed sometimes while playing some 320 CBR files on Foobar 2000, the bitrate fluctuates a lil bit : 319 kbps or even 321 kbps. Is that a bug ? Does that mean LAME encoder can't scrupulously achieve a constant bitrate ?

Moreover, as I want to compare audio encoding to video one, I have always thought using a constant bitrate to encode is a bad idea. Futhermore, when you encode a video is it widely accepted 1 pass (and Constant Bitrate) rate control mode is inferior to 2 pass rate control mode which lead to far better quality encodes. But, on the other hand, I've read so many papers around claiming 320 cbr is better than V0 VBR, evidence to support. Should I deduce audio encoding can't be compared to video encoding ? It logically comes to my mind that if the bitrate fluctuates, the resulting file is more optimized and consequently "better".

sneaker_ger
11th March 2013, 13:26
You're comparing apples to oranges.

First:
1 pass encoding is not inherently inferior to 2 pass encoding. Since you have been discussing x264 a lot, you should be very well aware of that. CRF is about equal to 2 pass at the same bitrate.

Second:
320 cbr is a corner case of mp3 and better than the VBR modes for a single reason: it is the maximum bitrate you can use with mp3. VBR couldn't use higher bitrates for complex audio parts even if it wanted to, so any VBR mode will also be smaller (lower bitrate) than CBR 320 and in turn be of lower quality.

sirt
11th March 2013, 13:40
Thanks sneaker_ger. About CRF : it is not constant bitrate in fact so i guess it is something quite different from what I had in mind, 1 pass constant bitrate.

Moreover, what do you think about 2 pass audio encoding ? detmek told me it is not available in many encoders nor many people use it but Nero AAC allows that mode.

sneaker_ger
11th March 2013, 13:48
In principal it's the same as in video encoding - I don't think there's much to discuss about it. If you want to hit a specific average bitrate/file size while achieving a constant quality, then it's for you.

pandy
14th March 2013, 15:18
Second:
320 cbr is a corner case of mp3 and better than the VBR modes for a single reason: it is the maximum bitrate you can use with mp3. VBR couldn't use higher bitrates for complex audio parts even if it wanted to, so any VBR mode will also be smaller (lower bitrate) than CBR 320 and in turn be of lower quality.

not sure - check each mp3 320kbps CBR with this http://wiki.hydrogenaudio.org/index.php?title=MP3packer - perhaps after stuffing removing real bitrate will be lower than 320kbps.