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: LAME MP3 - CBR, VBR, and channel mode options (Read 11686 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

LAME MP3 - CBR, VBR, and channel mode options

Hi everyone,

I've been delving a bit into LAME MP3 encoding options lately and had some specific questions about different combinations of encoding options.

When using Dual Mono mode with CBR encoding, I found it pretty easy to understand what this does. On a CBR 320 encode you basically get 160kbps on each channel as the bitrate it set and the channels are separate.

I noticed you can also encode using VBR and Dual Mono mode. Since it's been hard for me to find much (understandable) documentation on some of these options and combination of options, I thought I would ask the community here if anyone can shed some light on how the aforementioned VBR->Dual Mono actually works in the sense of how bitrate gets calculated over the channels.

I encoded a track using the following settings: -m d -V 0 -q 0 -lowpass 22.1 -- (so this is Dual Mono mode). When I did this, MediaInfo tells me I got an average bitrate of 292 Kbps. When I did an encode of the same track but used Joint Stereo mode instead, the file size of the (75mb) track was maybe 40kb bigger than the Dual Mono encoded track, so negligible, and the average bitrate is also 292kbps. OK, so one can encode in VBR and Dual Mono; at first I did not realize this as not that many frontends for LAME even feature the Dual Mono option, but I see now this is possible. Perhaps I was mixing up my understanding of VBR with Joint Stereo. So am I correct to assume that if I use VBR and Dual Mono, that basically VBR still calculates (via its psycho-acoustic model) what the required bit-density of any given passage in a track is, but in Dual Mono mode does this separately on each channel? Is that a good way of thinking about it? Perhaps VBR does this anyway, but with Joint Stereo mode it's actually JS doing its own thing despite of VBR or CBR or what have you? Does that sound reasonable? Any comments or insights anyone might have, please share, because I have more questions that I'm not even sure how to formulate yet and any insights will definitely help.

The Dual Mono mode is not one I actively use, but I would like to have a better understanding of all encoding options. I do have some binaural tracks that I have considered encoding in Dual Mono mode due to its absolute separation of L + R channels, although when I did detailed spectral analyses (and listening tests) of a Joint Stereo encoded MP3 I could not detect any mixing of L + R channels either, and I think this helped my mind getting firm in considering the idea that 'Joint Stereo degrades binaural beats tracks' as myth. Still, I would like to form a better understanding of the various encoding modes and methods.

Thanks in advance for any comments or insights

LAME MP3 - CBR, VBR, and channel mode options

Reply #1
For a real binaural recording (as in, a field recording done with 2 mics simulating human ears) the encoder is probably using L+R for most of all the frames anyway, since the channels differ significantly.

The thing with joint stereo, it doesn't force left/right or mid/side encoding. It lets the encoder choose what's best dynamically based on the source signal. If there's no correlation between the channels, you'll get a file that's mostly L+R. Take a mono mix of a song, and you'll get a file where every frame is M+S. Without changing any encoder settings.

There was a program - MP3EncSpot I think it was - that let you view the percentage of left-right frames and the percentage of mid-side frames in an MP3. With "normal" music where some instruments are center, some are to the side, you'll see a mix. For special cases like binaural recordings I would expect the balance to heavily favor l+r frames.

LAME MP3 - CBR, VBR, and channel mode options

Reply #2
Thanks for the reply, slks.

Ah yes, binaural recordings, now that you mention it I remember I came across nature sound recordings a long time ago done with a human head dummy with mics for ears. Thanks for refreshing my memory, but I was actually thinking about the binaural beat tracks (brainwave entrainment), where different tones are coming (via headphones) into each ear. So for example there may be a 100hz tone in the left ear, and a 104hz tone in the right ear, which makes for a difference of 4hz. For such entrainment to be effective a division of left + right channels is essential. From my spectral analysis and listening test it seems Joint Stereo has no adverse effect on such tones, but I can't say I understand it completely from the LAME MP3 point of view and Joint Stereo, etc.

I'll check out that program you mentioned. Looks from your location we're only 2 hours apart (well, by car that is).

LAME MP3 - CBR, VBR, and channel mode options

Reply #3
Do not use Dual Mono.
Generally you won't find decoders that play it as mono, but Dual Mono is exactly that: two mono channels, originally intended as "Dual" in the sense used in TV. :  Language A and Language B. (So, choosing one or the other).

I do not believe that you got the same bitrate encoding in Dual mono than in Joint Stereo. Like the documentation says, dual mono is used as two independent signals, so encoding separetely each as a mono stream but stored inside a single file. This means that the bitrate is exactly half for each.

When using simple stereo, the bitrate is shared for both left and right, so one channel can use more bitrate in a specific passage than the other.
You will have a situation similar to dual mono just when the two channels are the same (as in mono) or when the signal is similar in both channels in terms of energy (so, with very similar bitrate requirements).

Lastly, Joint stereo, when using the Mid/Side encoding, is able to use much more bitrate for Mid than side. (The more mono it is, the smaller side can be).


So for your scenario to be possible, the signal should be sufficiently different to not use Mid/Side, but sufficiently "equal" to have very similar bitrate requirements for both channels.

The only other reason for the difference to be so small is that your final bitrate is 292, and there only exists 256 and 320 kbps packets, so it cannot fluctuate much.
But if you were to encode a common stereo song, I am sure the differences would be much more important.



Btw: On a side note:  Even if you tell the encoder to "not use a lowpass" (setting it above half the sampling rate), That will not prevent it from removing content when it finds it "useless" in the context of audibility (ATH, etc...).

LAME MP3 - CBR, VBR, and channel mode options

Reply #4
Thanks for the reply, JAZ.

Quote
I do not believe that you got the same bitrate encoding in Dual mono than in Joint Stereo.

Yes, I think because it was done in Dual Mono, the bitrate is actually half for the 'whole track' as it were.

Quote
So for your scenario to be possible, the signal should be sufficiently different to not use Mid/Side, but sufficiently "equal" to have very similar bitrate requirements for both channels.

Very well put, that helps wrap the idea up, yes.

Quote
The only other reason for the difference to be so small is that your final bitrate is 292, and there only exists 256 and 320 kbps packets, so it cannot fluctuate much.

Does what you say there mean that there are only 256 and 320 packets available in MP3 encoding (ever)? So when it fluctuates in VBR, it really only fluctuates as either 256 or 320 (nothing in between)?

Quote
But if you were to encode a common stereo song, I am sure the differences would be much more important.

What exactly do you mean by this?

Quote
Btw: On a side note: Even if you tell the encoder to "not use a lowpass" (setting it above half the sampling rate), That will not prevent it from removing content when it finds it "useless" in the context of audibility (ATH, etc...).

Thanks for the info. Is there something about the encoding options I used/mentioned that made you say that, or is that just a FYI? I did not set a lowpass but I did notice the -lowpass 22.1 part when checking the MP3 with MediaInfo, so I guess the frontends I had been using did this (which were dBpoweramp 14.4 and Lame Frontend 1.8).

LAME MP3 - CBR, VBR, and channel mode options

Reply #5
Quote
The only other reason for the difference to be so small is that your final bitrate is 292, and there only exists 256 and 320 kbps packets, so it cannot fluctuate much.
Does what you say there mean that there are only 256 and 320 packets available in MP3 encoding (ever)? So when it fluctuates in VBR, it really only fluctuates as either 256 or 320 (nothing in between)?
He means there are only those two sizes of frames at that high end of the scale. There are plenty sizes available below those: 224, 192, 160, 128, 96, 80, 64, 56, 48, 40, and 32 kbps. Reference: http://id3.org/mp3Frame

LAME MP3 - CBR, VBR, and channel mode options

Reply #6
Thanks, db1989, and thanks for the useful link!

LAME MP3 - CBR, VBR, and channel mode options

Reply #7
db1989 answered about the bitrates.

About the other two questions, I meant that I expect that a common stereo song would have a bigger difference in bitrate usage between dual mono and joint stereo (as a consequence that it would use more mid/side frames and as such, require less bitrate for the same quality).

And about the setting, yes, I meant the lowpass switch. If you didn't write it explicitely, maybe it is a frontend, or maybe is mediainfo that guesses it from the V setting.  (I think that recently V0 was allowed to use all the frequency bandwitdth, but I haven't kept up to date about that)

LAME MP3 - CBR, VBR, and channel mode options

Reply #8

db1989 answered about the bitrates.

About the other two questions, I meant that I expect that a common stereo song would have a bigger difference in bitrate usage between dual mono and joint stereo (as a consequence that it would use more mid/side frames and as such, require less bitrate for the same quality).

Thanks for the clarification, JAZ.

The binaural tracks I was interested in encoding may have up to 10 frequency pairs (like 100 and 104hz being one), and those are just tones, nothing overly complex. And those are all contained within the 50hz to 1000hz spectrum and are well defined. All the other audio (including pink noise modulations, or sometimes music, etc.) are not different between L + R (meaning they don't have a difference in frequency between channels applied to them as far as binaural beat goes). So but for the binaural tones (few in number) the rest of the tracks are pretty much common stereo tracks, as it were.

And about the setting, yes, I meant the lowpass switch. If you didn't write it explicitely, maybe it is a frontend, or maybe is mediainfo that guesses it from the V setting.  (I think that recently V0 was allowed to use all the frequency bandwitdth, but I haven't kept up to date about that)

I'm seeing such a lowpass mentioned by MediaInfo with all frontends (as far as I can remember) I've tried so far, which include dBpoweramp, TAudioConverter, Lame Front-End, and others. So they're either all adding that in or it is MediaInfo. I like the MediaInfo Lite version as it's clean and to the point (http://codecguide.com/download_other.htm is a good place to get it) but there may be better apps out there for that but I'm not familiar with them.

LAME MP3 - CBR, VBR, and channel mode options

Reply #9
I could not detect any mixing of L + R channels either...
I think you might misunderstand how joint stereo works.    It does mix the left & right channels, but in a completely reversable* way.  

M/S encoding (mid/side) takes the existing two left & right channels and creates two new channels, a L+R chanel and a L-R channel.    You just as easily reverse the M/S encoding and get your original separate stereo channels back.    i.e. (L+R) - (L-R)/2 = R  and  (L+R) + (L-R)/2 = L.

This is not a new idea and it can be done in analog.      It has always been used in FM stereo broadcast for mono compatibility long ...  An old  mono FM radio can receive the L+R signal and won't decode L-R signal.   

MP3 benefits from M/S encoding if there is lots of information in the L+R channel and little information in the L-R channel.  It only has to encode the common information once, and it can use most of the bits encoding the L+R channel and very-few bits encoding the L-R channel.  That allows higher-quality or a lower bitrate.





* Of course after lossy compression, it's not mathematically reversable and you can never get your original bytes back. 


LAME MP3 - CBR, VBR, and channel mode options

Reply #10
Yes, the encoding process for mid/side stereo, which is what we tend to mean when we use the term joint stereo, is mathematically lossless. It is a key part of lossless encoders too. In lossy compression, all it does is to promote efficient encoding of stereo frames when the two channels are largely similar (and hence mid has a large value while side has a small one).

I suspect that mistakenly thinking the opposite is why many people seem to have an aversion to joint stereo, imagining that it constricts the soundstage and whatnot. In some cases, this is probably due to people confusing mid/side stereo with intensity stereo, which, by some definitions, can fall under the umbrella of joint stereo. In others, the cause is most likely just fear, uncertainty, and doubt, in classic ’phool style.

LAME MP3 - CBR, VBR, and channel mode options

Reply #11
So for example there may be a 100hz tone in the left ear, and a 104hz tone in the right ear, which makes for a difference of 4hz. For such entrainment to be effective a division of left + right channels is essential. From my spectral analysis and listening test it seems Joint Stereo has no adverse effect on such tones, but I can't say I understand it completely from the LAME MP3 point of view and Joint Stereo, etc.


If you care about precise control over the frequency content of tones, you may want to consider a lossless format. 

LAME MP3 - CBR, VBR, and channel mode options

Reply #12
So for example there may be a 100hz tone in the left ear, and a 104hz tone in the right ear, which makes for a difference of 4hz. For such entrainment to be effective a division of left + right channels is essential. From my spectral analysis and listening test it seems Joint Stereo has no adverse effect on such tones, but I can't say I understand it completely from the LAME MP3 point of view and Joint Stereo, etc.


If you care about precise control over the frequency content of tones, you may want to consider a lossless format.

In fact, shouldn't lossless compression be highly efficient for pure sine waves, maybe even better than lossy?

 

LAME MP3 - CBR, VBR, and channel mode options

Reply #13
So for example there may be a 100hz tone in the left ear, and a 104hz tone in the right ear, which makes for a difference of 4hz. For such entrainment to be effective a division of left + right channels is essential. From my spectral analysis and listening test it seems Joint Stereo has no adverse effect on such tones, but I can't say I understand it completely from the LAME MP3 point of view and Joint Stereo, etc.

Joint stereo will have no adverse effect in this situation because unless the two channels have enough similarity to merit mid/side encoding, all frames will be encoded as left/right anyway. Your left and right channels have no such similarity, so it would make no difference whether you use joint stereo or not.