I have a 5.1 audio track from a film where front left and front right contains music, and center contains dialogue. Playing the 5.1 track in VLC blends everything together nicely.

I'm trying to convert the 5.1 track to stereo using ffmpeg -ac 2, however the resulting stereo mix has a much weaker volume than playing the 5.1 track natively.

Adding -af "pan=stereo|c0=FL|c1=FR" gives the correct volume, but then there is no dialogue because the center channel is not included.

So the solution is maybe to mix left/center/right into stereo, and throw out the back end subwoofer channels? (I'm guessing here...)

So the question is: How do I make ffmpeg downmix 5.1 to stereo the same way VLC does it, with the same strong volume in the end result?

  • Are you sure VLC is actually playing the additional channels? Downmixing can result in normalization so that the sum of each input per output channel does not result in overload so clipping is prevented. This can make it sound quieter. – LordNeckbeard Dec 14 '14 at 18:15
  • The basics: My file is 5.1. My speakers are stereo. I don't know what VLC does, but it creates a great end result in my stereo speakers from the 5.1 source data (strong volume, both music and dialogue included). ffmpeg, on the other hand, creates a "low volume" result when using -ac 2. So I'm asking how to make ffmpeg generate the same good result as VLC does. – forthrin Dec 16 '14 at 10:20

I found the answer Shane provided to provide too little of the other channels and too much of the center. Movies with headphones sounded off balance, with all dialog and not enough background music/effects.

According to ATSC standards (section 7.8, page 91), The following formula is used to downmix 5.1 to conventional stereo (as opposed to matrix):

Lo = 1.0 * L + clev * C + slev * Ls ;
Ro = 1.0 * R + clev * C + slev * Rs ;

clev and slev should be .707, according to tables 5.9 and 5.10 in the aforementioned document, assuming a center/surround mix level of 0. Other values are provide in those tables which reduces the amount of center mix, which I don't find useful.

With this in mind, the following ffmpeg option produces a good balanced sound with audible dialog. Note that specifying the audio channels is not necessary.

-af "pan=stereo|FL < 1.0*FL + 0.707*FC + 0.707*BL|FR < 1.0*FR + 0.707*FC + 0.707*BR"

A note on the use of the less-than symbol, from the pan filter documentation:

If the ‘=’ in a channel specification is replaced by ‘<’, then the gains for that specification will be renormalized so that the total is 1, thus avoiding clipping noise.

Try this downmix:

-ac 2 -af "pan=stereo|FL=FC+0.30*FL+0.30*BL|FR=FC+0.30*FR+0.30*BR" 

as suggested in:
Dialogue nightmode downmix preset for 5.1 DTS to 2.0 AAC stereo using ffmpeg and qaac

  • 1
    What do all those options mean? If you explain them, people will be able to use your answer to solve different problems instead of just copy-pasting. – David Richerby Mar 4 '16 at 21:12
  • 2
    @DavidRicherby -ac = Audio Channels (2 for stereo), -af = Audio Filter – Cestarian Mar 23 '16 at 4:14
  • 2
    Tried this for a 5.1 movie and at least the output stereo sounded completely fine to me. Clear dialogue and nothing else seemed to be missing. Would be great if someone with VLC knowledge could share exactly what is done in the default 5.1 to 2.0 downmix there. – forthrin Jul 8 '16 at 10:28
  • 1
    @DavidRicherby: The options inside the audio filter (-af) are: FL=Front-left; BL=Back-left; FC=Front-center; FR=Front-right; BR=Back-right. The floats are linear factors to reduce (<1) or increase(>1) the volume of the multiplied channel. FL=FC+0.30*FL+0.30*BL is setting the Front-left channel to the Front-Center channel plus 30% of the Front-left and 30% of the Back-left channels. – kronenpj Jan 15 '17 at 22:13
  • 1
    FWIW: I find this mix make dialogues be way too loud compared to the music and ambient sounds. The technically more correct mix given in Tarc's answer is much more pleasing to me. So I guess you might have to try what works best for you, it depends on the situation. – jlh Feb 7 at 22:12

So, by combining @Shane Harrelson's with @Jordan Harris's answer to another question - with lazy mode turned on - here what's needed to convert input_51.mkv (5.1) into output_stereo.mkv (stereo):

ffmpeg -i input_51.mkv -c:v copy \
    -ac 2 -af "pan=stereo|FL=FC+0.30*FL+0.30*BL|FR=FC+0.30*FR+0.30*BR" \
    output_stereo.mkv

The -c:v copy part means that the video stream is not being touched (I guess that the video codec settings is being copied). Without it, it will take much longer. Just repeating from the above answer for completude, -ac 2 means two audio channels and -af specifies an audio filter.

After looking into the command a bit, I figured out that it's setting how the two stereo channels are composed; the FL (front left channel) is taken from the original FC (front center) plus 0.30*FL (30% from the front left) plus 0.30*BL (30% from the back left) and so on.

  • Will this keep the center channel consistent and audible? – Freedo Aug 7 '17 at 10:54

If the -ac 2 option gives you a balanced downmix where neither the music nor the speech sounds too much more than the other components, you just need to boost the volume with

-vol 512

I used 512 in the example, which increases the sound making it two times louder. The rule is that 256 is equivalent to 100%

Do not go too high with the value, and be sure to check the results in those parts of the movie with explosions or loud noise. Is is very easy to introduce distorsion by using a too high value.

This is an old question now, but pointed me in the right direction and wanted to share my result. Loosely following Gregory's answer:

pan=stereo|FL=0.5*FC+0.707*FL+0.707*BL+0.5*LFE|FR=0.5*FC+0.707*FR+0.707*BR+0.5*LFE

Putting half of the FC and LFE into left and right gives a total of 1 for their effective volumes from both speakers. Using .707 * Front/Back Left/Right brings those channels down to a good level so they don't overpower the center.

New contributor
Dave_750 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.