5.1 to stereo downmix

Useful and helpful Windows specific command line samples and examples.
svnpenn
Posts: 263
Joined: Tue Nov 01, 2011 12:19 am

5.1 to stereo downmix

Post by svnpenn » Thu Mar 06, 2014 3:10 am

Hello all! I posted this question
superuser.com/q/723731

and I noticed it got attention of Zeranoe

lists.ffmpeg.org/pipermail/ffmpeg-devel-irc/2014-March/001958.html

I would like to add to this. My reason is that sometimes I have a video with 5.1
audio, and I would like to downmix it to stereo. I noticed that when I run basic
command such as

Code: Select all

ffmpeg -i 51.mp4 -ac 2 outfile.mp4
It was giving me generally poor audio mixing. For example the dialogue was
always too low, and the extra sounds too high. So when watching a video I would
be constantly messing with the volume. Well I believe this is due to the default
mixing with FFmpeg. Here are the defaults

Code: Select all

FL = FL + 0.707FC + 0.707BL
FR = FR + 0.707FC + 0.707BR
Now you can quickly see the issue here. Typically dialogue comes through the
center channel, which is being gained down with the default coefficient. So to
fix this we need to either raise the center or lower the surround. I chose to
do both. According to

ffmpeg.org/ffmpeg-all.html#Downmix-Levels

you are not supposed to lower surround beyond "0.500". The highest recommended
gain for center channel is "1.414", so I went with that. A final example command
would be

Code: Select all

ffmpeg -i 51.mp4 -c:v copy -b:a 256k -ac 2 -clev 1.414 -slev .5 outfile.mp4
Or

Code: Select all

ffmpeg -i 51.mp4 -c:v copy -b:a 256k -ac 2 -clev 3dB -slev -6dB outfile.mp4
Example

Further reading

ffmpeg.org/ffmpeg-all.html#Resampler-Options
Last edited by svnpenn on Mon Jun 02, 2014 10:33 pm, edited 1 time in total.

User avatar
Zeranoe
Site Admin
Posts: 640
Joined: Sat May 07, 2011 7:12 pm
Contact:

Re: 5.1 to stereo downmix

Post by Zeranoe » Thu Mar 13, 2014 2:40 pm

I again brought this to the attention to the devs, and they suggested the best way to talk about it would be by submitting a patch on the mailing list.

svnpenn
Posts: 263
Joined: Tue Nov 01, 2011 12:19 am

Re: 5.1 to stereo downmix

Post by svnpenn » Thu Mar 13, 2014 5:26 pm

Zeranoe wrote:I again brought this to the attention to the devs, and they
suggested the best way to talk about it would be by submitting a patch on the
mailing list.
As you well know, that is a common dev way of saying
I dont care about that issue, if you want to patch it yourself I might
consider committing it.
Well I dont deal with those type people. My workaround works for me, maybe one
day they take their head out of ass and realize "-ac 2" sucks, and has sucked
for a long time.

llogan
Posts: 328
Joined: Fri Mar 14, 2014 3:29 am

Re: 5.1 to stereo downmix

Post by llogan » Fri Mar 14, 2014 3:32 am

svnpenn wrote:Well I dont contribute.
Fixed that for you.

svnpenn
Posts: 263
Joined: Tue Nov 01, 2011 12:19 am

Re: 5.1 to stereo downmix

Post by svnpenn » Mon Mar 17, 2014 1:06 am

llogan wrote:
svnpenn wrote:I contribute a great deal to the open source community.
github.com/svnpenn
Fixed that for you.

llogan
Posts: 328
Joined: Fri Mar 14, 2014 3:29 am

Re: 5.1 to stereo downmix

Post by llogan » Wed Mar 19, 2014 12:23 am

Jokes aside, have you actually tried submitting a patch to FFmpeg? That is how contributions are usually made to the project. I don't understand your negative attitude towards patch submissions.

svnpenn
Posts: 263
Joined: Tue Nov 01, 2011 12:19 am

Re: 5.1 to stereo downmix

Post by svnpenn » Wed Mar 19, 2014 12:50 am

llogan wrote:Jokes aside, have you actually tried submitting a patch to FFmpeg? That is how contributions are usually made to the project. I don't understand your negative attitude towards patch submissions.
I do submit patches, when I feel like it.

article.gmane.org/gmane.comp.version-control.git/244180

In this case I dont feel like it, so submit it yourself if you care so much.

pm1315
Posts: 2
Joined: Fri Mar 21, 2014 4:26 am

Re: 5.1 to stereo downmix

Post by pm1315 » Fri Mar 21, 2014 4:34 am

Robert Collier, over in the Doom Forum has come up with a "nightmode" preset matrix
that seems effective in making dialog clearer without lowering overall volume:

"pan=stereo|FL=FC+0.30*FL+0.30*BL|FR=FC+0.30*FR+0.30*BR"

http://forum.doom9.org/archive/index.php/t-168267.html

svnpenn
Posts: 263
Joined: Tue Nov 01, 2011 12:19 am

Re: 5.1 to stereo downmix

Post by svnpenn » Sat Mar 22, 2014 6:37 am

pm1315 wrote:Robert Collier, over in the Doom Forum has come up with a
"nightmode" preset matrix
that seems effective in making dialog clearer without lowering overall volume:
"pan=stereo|FL=FC+0.30*FL+0.30*BL|FR=FC+0.30*FR+0.30*BR"
http://forum.doom9.org/archive/index.php/t-168267.html
I already know about his mix. The reason I posted mine is because he does not
follow any standards with his mix. He seems to take his coefficents
"out of thin air". The documentation link in the OP corroborates this.

deejay220989
Posts: 1
Joined: Sun Apr 06, 2014 1:48 pm

Re: 5.1 to stereo downmix

Post by deejay220989 » Sun Apr 06, 2014 1:54 pm

I tried both commands, Robert's one works best for me.

I still have to play around with my volume when using the command at the first post. Is the one at the first post the best command that should be used? Or it's just an example?

Post Reply