Log in

View Full Version : Does FFMPEG convert 5.1 to 2.0 properly by default??


syrist
17th January 2020, 15:05
Hi, I normally use ffmpeg+neroaacenc to downmix AC3 and DTS surround to 2 channel AAC using the following command line:

ffmpeg.exe -y -i SOURCE.MKV -ac 2 -acodec pcm_s16le -f wav - | neroAacEnc.exe -ignorelength -if - -of DESTINATION.AAC

I was reading on this forum that some people like to tweak the volume levels of some channels (ie. increase center and decrease surround, etc.) so the dialog doesn't get overpowered/

So I was just wondering if when ffmpeg downmixes multichannel to 2 channel if it just blindly merges all the channels together or if it makes level adjustments to some of the channels before downmixing.

Thanks.

Sparktank
17th January 2020, 21:50
Yeah, it will downmix properly, according to standards. Remember the standards omit the LFE channel.
https://trac.ffmpeg.org/wiki/AudioChannelManipulation#a5.1stereo

You can use the pan audio filter to customize the downmix how you want.
https://ffmpeg.org/ffmpeg-filters.html#pan-1

tebasuna51
18th January 2020, 11:56
Yeah, it will downmix properly, according to standards. Remember the standards omit the LFE channel.
https://trac.ffmpeg.org/wiki/AudioChannelManipulation#a5.1stereo

It is not exact. The standards showed in section 7.8 of .pdf related in ffmpeg docs are:

For a standard mix:
Prior to the scaling needed to prevent overflow, the general 3/2 downmix equations for an LoRo stereo signal are
Lo = 1.0 * L + clev * C + slev * Ls ;
Ro = 1.0 * R + clev * C + slev * Rs ;

or for a DPL mix:
Prior to the scaling needed to prevent overflow, the 3/2 downmix equations for an LtRt stereo signal are
Lt = 1.0 * L + 0.707 * C – 0.707 * Ls – 0.707 * Rs ;
Rt = 1.0 * R + 0.707 * C + 0.707 * Ls + 0.707 * Rs ;

But ffmpeg do:
L = 0.4142 * L + 0.2929 * C + 0.2929 * Ls
R = 0.4142 * R + 0.2929 * C + 0.2929 * Rs

From a un-normalized mix of:
L = 1.0 * L + 0.707 * C + 0.707 * Ls
R = 1.0 * R + 0.707 * C + 0.707 * Rs

Is a standard mix (not DPL) but ignoring the 'clev' and 'slev' parameters included in AC3 headers.

clev can be:
0.707 (my recommendation when encode: -center_mixlev 0.707)
0.595 (the default when encode with ffmpeg)
0.500 (never recommended)

slev can be:
0.707 (not recommended)
0.500 (the default and recommended with ffmpeg)

My recommended un-normalizad mix standard is:
L = 1.0 * L + 0.707 * C + 0.500 * Ls
R = 1.0 * R + 0.707 * C + 0.500 * Rs

and normalized:
L = 0.453 * L + 0.320 * C + 0.227 * Ls
R = 0.453 * R + 0.320 * C + 0.227 * Rs

But for users than experiment low dialog volume we can modify the coeficients.

syrist
27th January 2020, 20:45
It is not exact. The standards showed in section 7.8 of .pdf related in ffmpeg docs are:

For a standard mix:


or for a DPL mix:


But ffmpeg do:


From a un-normalized mix of:


Is a standard mix (not DPL) but ignoring the 'clev' and 'slev' parameters included in AC3 headers.

clev can be:
0.707 (my recommendation when encode: -center_mixlev 0.707)
0.595 (the default when encode with ffmpeg)
0.500 (never recommended)

slev can be:
0.707 (not recommended)
0.500 (the default and recommended with ffmpeg)

My recommended un-normalizad mix standard is:


and normalized:


But for users than experiment low dialog volume we can modify the coeficients.

Great info... thanks for the reply. I'll adjust my batch file command line settings.