libebur128 icon indicating copy to clipboard operation
libebur128 copied to clipboard

Mono Loudness: Dual vs 1-Channel

Open tigerite opened this issue 9 years ago • 7 comments

Hello

I am a little confused about how loudness is calculated for a mono audio track.

If I only have a 1-speaker sound system, which mono mode is the correct one to use: left or right, center, or dual?

I believe by default libebur128 treats a mono track as a left channel mono track. You can of course explicitly set the channel to the other modes as well.

Here is my normalization example:

  1. Start with a 2-channel stereo audio track

  2. Convert it to mono using the standard median method

  3. Measure the EBUR128 integrated loudness using the default libebur128 channel configuration: left channel

    a. Let's assume the integrated loudness measured is -20 LUFS

  4. Calculate the gain adjustment

    a. Let's use a target reference of -16 LUFS b. Then, the gain adjustment is +4 LU (dB)

  5. Apply gain adjustment

    a. So now the mono version will have an integrated loudness of -16 LUFS

  6. Save mono track to as a f32le wav file.

If I then measure the integrated loudness using FFMPEG's ebur128 filter, I get -16 LUFS.

However, if I use libebur128 with the default channel configuration of left channel mono, I will get a value that is below -19 LUFS (-3 LU less).

If I use libebur128 and explicitly set the channel to dual mono channel configuration mode instead, I get -16 LUFS.

So this is where I am confused.

Shouldn't I have gotten -16 LUFS under the default libebur128 channel configuration for mono (left channel)?

Why does setting to dual mono give me the expected result of -16 LUFS?

Thanks!

tigerite avatar Oct 14 '15 17:10 tigerite

Are you sure that the f32le wav file is mono? I've compared ffmpeg and libebur128 and they are showing the same behavior in my test:

loudness scan stereo.wav: -6.1LUFS ffmpeg -nostats -i stereo.wav -filter_complex ebur128 -f null -: -6.1LUFS loudness scan mono.wav: -9.5LUFS ffmpeg -nostats -i mono.wav -filter_complex ebur128 -f null -: -9.5LUFS

I have generated the mono file with ffmpeg -i stereo.wav -ac 1 mono.wav. If I'm reading the standard correctly, this is expected behavior. There is only one speaker involved with mono files so the volume is lower. It does not matter if you use left, center or right channel when scanning a mono signal. The dual mono mode of libebur128 is just for convenience if you need it for some reason, for example if you expect the mono file to be played back on a stereo system.

jiixyj avatar Oct 14 '15 17:10 jiixyj

Hi

I haven't been able to get the "loudness" command to find plugins so I can test it out myself. See the issue I raised in the loudness-scanner git.

How does the loudness scan commandline handle mono files?

I looked through the code and from scanner-common.h there is a struct scan_opts. This struct contains a field: force_dual_mono

Is this TRUE or FALSE by default?

If it is TRUE by default, then the loundness scan tool will be operating in dual mono mode for a mono audio file.

Thanks!

tigerite avatar Oct 14 '15 18:10 tigerite

I got loudness-scanner working.

It shows the same intregrated loudness value as ffmpeg for my mono file.

But when I use libebur128 directly, using the default channel mode of left channel, I am getting a result that is about 3 LU less. Only if I set the channel mode to dual mono do I get the same integrated loudness as ffmpeg and loudness-scanner.

This makes me believe loudness-scanner is working in dual mono mode.

tigerite avatar Oct 14 '15 20:10 tigerite

loudness-scanner only uses dual mono mode in tag mode. Something else must be going on. Have you tried minimal-example.c from the test folder? This gives the following output with my test files, matching the output of loudness-scanner and ffmpeg:

$ ./a.out stereo.wav
-6.12 LUFS, stereo.wav
-----------
-6.12 LUFS

$ ./a.out mono.wav
-9.45 LUFS, mono.wav
-----------
-9.45 LUFS

jiixyj avatar Oct 14 '15 20:10 jiixyj

Thanks. I built minimal-example and ran it against my mono file.

It returned the expected integrated loudness value.

So now I'm trying to figure out why my custom code that uses libebur128 requires dual mono mode to get the same result.

My custom code uses float 32-bit pcm data so I use the function ebur128_add_frames_float instead though. I'm not sure if that makes a difference.

tigerite avatar Oct 14 '15 22:10 tigerite

There have been numerous discussion in the EBU ploud group about the measure of mono signals. What's the issue ? The standard considers that a mono signal has to be measured as a single channel that will be reproduced on a single loudspeaker. When playing this signal either on a single loudspeaker or on two loudspeakers with the appropriate pan law (the mono signal is sent approx. -3 dB attenuated to L and R speaker), the perceived loudness is equivalent. Unfortunately, several software players or tv set decoders on various platform do not apply the pan law and will send the mono channel to both loudspeaker without attenuation. The perceived loudness therefore is raised by about 3 dB. Solutions Several organization that commonly use mono format for streaming/broadcasting would like that this issue to be taken into account at the measure stage (ie measuring a one channel mono file as if it was a two channel dual mono one) while other organizations consider that the standard shouldn't trick the measure to compensate lack of standard conformance on the end user side. That would also create the issue that players that do enforce a pan law would then play the mono files with a different perceived loudness. To my knowledge, there's currently no consensus in the group and therefore, measuring one channel mono signal vs two channel double mono signal gives different results purposefully.

audionuma avatar Apr 23 '16 08:04 audionuma

This one can be closed. EBUR128_DUAL_MONO solves this problem.

kylophone avatar Nov 01 '16 15:11 kylophone