-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to downmix 5.1 into stereo properly? I got overflow even with the -3DB Matrix by Summing the individual output channels. #34
Comments
Are you sure you're not supposed to subtract 0.707 from the center and rear channels, before combining them into the output stereo channel? |
Do you mean the correct formula should be: |
I mean Lo = FL + (C - 0.707), + (SL - 0.707) |
Confused, |
Subtraction is clearly the wrong way to go. You are supposed to multiply C by 0.707 in any case, since that compensates for cloning the (single) C channel into two channels. Most people also multiply the surrounds by that to avoid the surrounds interfering with the front sounds too much (ie. your original formula) However, this formula can cause overflows if the original audio signal already is at full volume. The only way to reliably combat this is to reduce the overall volume to avoid clipping - this is what ffmpeg does. It will result in somewhat quieter track, but its the only way to absolutely be sure that it will never overflow/clip. |
Actually, libswresample and libavresample have different defaults. libswresample doesn't do it AFAIK, which will sometimes result in clipping. I guess it boils down to the user's preference: get audio that's "too silent", or audio that might clip. |
So there's no way to make a established downmix result with non-suppressed gain and without any clip? |
swresample is a bit dumb. It does it when you use integer internal/output, but doesn't with float output, so yeah. |
Not without analyzing the audio first to get its real peak information. A general 1-pass operation has to assume that all channels can contain full range audio at the same time, and if you combine 1.0 + 0.707 + 0.707 it will overflow, so you have to reduce volume, ie. effectively dividing by 2.414 (which is about 7.5dB in reduction, iirc) |
That's why I started the discussion. I found some players request 5.1 channel configuration to the sound card via the waveOutOpen API by filling the corresponding Channel Flags (0x3F) to dwChannelMask, and will not lead to any overflow even I turn its volume and the system volume to the max together. The sound is louder than playing the downmix generated by ffmpeg (-7dB) directly in the player. It seems that the sound card can do the downmix correctly? The 1-pass peak scanning couldn't have any chance to be processed. |
Hi there, sorry to revive this old discussion but I'm looking for someone able to implement correctly the "Novel 5.1 Downmix Algorithm with Improved Dialogue Intelligibility" research:
Someone @ Hydrogenaudio forums implemented it in this way:
...do you think is correct (and proper) ? |
@forart this project is very dead. The decoder was moved to ffmpeg, talk to them. |
DCADec hasn’t been updated in like 4-5 years, it’s been merged into FFmpeg.
In FFmpeg you’re looking to remap the channels, search that.
… On Feb 1, 2022, at 8:44 PM, damian101 ***@***.***> wrote:
I just use the same command I use for 6.1 and 7.1 too:
-af 'lowpass=c=LFE:f=120,pan=stereo|FL=.3FL+.21FC+.3FLC+.3SL+.3BL+.21BC+.21LFE|FR=.3FR+.21FC+.3FRC+.3SR+.3BR+.21BC+.21LFE'
Maybe not ideal loudness-wise for 5.1, but I usually normalize to -23 LUFS anyway.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.
|
Hey!
1st if all, Thanks for your work on this.
I tried to got a stereo downmix of dts files.
However, I found the option -2 will not work if the dts file doesn't contain the downmix coffs.
So I tried to sum the individual audio tracks with the following formula:
Lo = FL + 0.707_(C+SL);
Ro = FR + 0.707_(C+SR);
This will cause the final stereo file distorted.
I compared with ffmpeg. It seems that its downmix will cause the volume became very low (about -9 dB).
So how should I do the downmix properly on the dts files that are not containing coff infos?
Looking forward to your reply.
Thanks!
The text was updated successfully, but these errors were encountered: