Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Downmixing X.1 audio to Stereo introduces clipping on some sources #2030
Description of the problem
I noticed when watching some movies encoded with Handbrake that some have clipping on loud parts. I mix down X.1 to Stereo. I have noticed this on DTS-ES or DTS-EX sources, and bizarrely if using the AAC (avcodec) codec the issue does not occur, but for all the others it does including the FDK AAC codec!
I have uploaded a short clip of The Incredibles which can be downloaded here.
Mix-down to Stereo using any audio codec except for the AAC (avcodec) and you can hear the clipping when the missiles explode at around 0:33
Doesn't seem to matter what bitrate is chosen for the output.
Now use the AAC (avcodec) output format and it does not clip, and overall the clip is quieter.
HandBrake version (e.g., 1.0.0)
Operating system and version (e.g., Ubuntu 18.04 LTS, macOS 10.14 Mojave, Windows 10 1809)
Windows 10 1809 64-bit
Error message text or screenshot
Please provide any error messages or screenshots that may help.
HandBrake Activity Log (see https://handbrake.fr/docs/en/latest/help/activity-log.html)
If you need more info please let me know!
Thanks for the reply
If you encode the mkv linked above (which is original source material) using my methods above, it results in clipping at the point the missiles explode at 0:33 when playing back on every player I have access too (except when using the avcodec aac encoder). I have to apply a gain of -6dB to stop the clipping.
This includes all media players I have access to:
The short answer is, there isn't an easy answer for this.
Your source has very little headroom, so it's not abnormal to see this effect.
With HandBrake, your only options are: Gain reduction, or --normalize-mix (CLI Only). Beyond that, you'll need a tool that has more advanced audio functionality than HandBrake can dream of having.
Thanks for the reply It doesn't explain why the clipping doesn't occur when using using AAC (avcodec) as the output audio format though! Using any any of the other audio codecs (including FDK aac if compiled from source) does result in the clipping in that passage of audio. I think it is something to do with DTS-ES. Perhaps avcoded aac handles it differently to all the others?…
________________________________ From: Scott <firstname.lastname@example.org> Sent: 18 June 2019 20:05 To: HandBrake/HandBrake Cc: AndrewR79; Author Subject: Re: [HandBrake/HandBrake] Downmixing X.1 audio to Stereo introduces clipping on some sources (#2030) The short answer is, there isn't an easy answer for this. Your source has very little headroom, so it's not abnormal to see this effect. With HandBrake, your only options are: Gain reduction, or --normalize-mix (CLI Only). Beyond that, you'll need a tool that has more advanced audio functionality than HandBrake can dream of having. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub<#2030?email_source=notifications&email_token=AD3A7LDRBM6BBIFHX62WVK3P3EWYHA5CNFSM4HEXFEVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODX7UVEQ#issuecomment-503270034>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AD3A7LEIKC73H365VQDQXS3P3EWYHANCNFSM4HEXFEVA>.
Variance between encoders seems reasonable to expect. Especially the AAC encoder given it's not long out of "beta" and still has some rough edges. There are obviously losses in that encoder that are lowering volume and likely quality. (In this case, it happens to be beneficial but may cause issues in other situations)