tebasuna51
22nd June 2021, 14:07
A wav source, encoded with DN = -25 dB, DRC = Film Standard, and after decoded with ffmpeg and some AviSynth decoders ():
AC3 decoded using drc : ffmpeg, FFAudioSource(), LWLibavAudioSource(), NicAc3Source(DRC=1), BestAudioSource()
AC3 decoded with drc 0: ffmpeg -drc_scale 0, NicAc3Source(), bassAudioSource()
wav source AC3 decoded using drc AC3 decoded with drc 0
------------------- --------------------- ----------------------
RMS power L: 16.30% (-15.76 dB) 5.99% (-24.45 dB) 16.10% (-15.86 dB)
RMS power R: 16.44% (-15.68 dB) 6.82% (-23.33 dB) 16.24% (-15.79 dB)
Min value L: -96.04% (-0.35 dB) -41.47% (-7.65 dB) -100.00% (0.00 dB)
Min value R: -95.96% (-0.36 dB) -40.95% (-7.75 dB) -97.32% (-0.24 dB)
Max value L: 94.69% (-0.47 dB) 43.56% (-7.22 dB) 97.69% (-0.20 dB)
Max value R: 94.52% (-0.49 dB) 41.85% (-7.57 dB) 98.64% (-0.12 dB)
Like you can see to preserve the full volume in AviSynth you need use NicAc3Source() or bassAudioSource()
The volume reduction is not only by Dialog Normalization (31-27= 6 dB) but also for Dynamic Range Compression (Film Standard here).
This AC3 have a Dyn. Range min/max : -11,78 / 1,02 dB
The DN can be changed in the ac3 stream, but not the DRC data.
To erase the DRC data you need recode the AC3 with ffmpeg (DRC data not created, select the same bitrate):
ffmpeg -drc_scale 0 -i "INPUT.ac3" -c:a ac3 -b:a 640k -center_mixlev 0.707 "OUTPUT.ac3"
[EDIT] Added Feature request for FFAudioSource() (https://github.com/FFMS/ffms2/issues/386)
Added Feature request for BestAudioSource() (https://github.com/vapoursynth/bestaudiosource/issues/4)
I don't know where add Feature request for LWLibavAudioSource() because https://forum.doom9.org/showthread.php?p=1943308#post1943308
-QfG-
25th June 2021, 02:35
Edit s_NicAudio.ext with an editor and change this Inline:
...then choose for ac3 Input Files "NicAC3Source" and the Output File is DRC Free.
<?xml version="1.0"?>
<BeHappy.Extension xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://workspaces.gotdotnet.com/behappy">
<AudioSource UniqueID="1B1E7952-5316-4C88-88DF-24EDCCD8A8C7">
<Plugin>
<MultiOptionSource Type="BeHappy.Extensions.MultiOptionSource, BeHappy">
<DialogWidth>200</DialogWidth>
<TitleFormatString>{0}</TitleFormatString>
<LoadAvsPlugin>nicaudio.dll</LoadAvsPlugin>
<SupportedFileExtension>mpg</SupportedFileExtension>
<SupportedFileExtension>mpeg</SupportedFileExtension>
<SupportedFileExtension>mpa</SupportedFileExtension>
<SupportedFileExtension>mp3</SupportedFileExtension>
<SupportedFileExtension>mp2</SupportedFileExtension>
<Script>%options%</Script>
<Radiobutton Name="NicMPG123Source">
<Value>NicMPG123Source("{0}")</Value>
</Radiobutton>
<Radiobutton Name="NicMPG123Source (Normalize)">
<Value>NicMPG123Source("{0}", true)</Value>
</Radiobutton>
</MultiOptionSource>
</Plugin>
</AudioSource>
<AudioSource UniqueID="ff49a26c-7348-4674-a28f-17bf7fcb38cc">
<Plugin>
<MultiOptionSource Type="BeHappy.Extensions.MultiOptionSource, BeHappy">
<DialogWidth>200</DialogWidth>
<TitleFormatString>{0}</TitleFormatString>
<LoadAvsPlugin>nicaudio.dll</LoadAvsPlugin>
<SupportedFileExtension>ac3</SupportedFileExtension>
<Script>%options%</Script>
<Radiobutton Name="NicAc3Source">
<Value>NicAc3Source("{0}", DRC=0)</Value>
</Radiobutton>
<Radiobutton Name="NicAc3Source (DRC)">
<Value>NicAc3Source("{0}", DRC=1)</Value>
</Radiobutton>
</MultiOptionSource>
</Plugin>
</AudioSource>
<AudioSource UniqueID="bd3ac54a-5c6a-4f9f-9d42-2d3990a0fafd">
<Plugin>
<MultiOptionSource Type="BeHappy.Extensions.MultiOptionSource, BeHappy">
<DialogWidth>0</DialogWidth>
<TitleFormatString>{0}</TitleFormatString>
<LoadAvsPlugin>nicaudio.dll</LoadAvsPlugin>
<SupportedFileExtension>dts</SupportedFileExtension>
<Script>%options%</Script>
<Radiobutton Name="NicDtsSource">
<Value>NicDtsSource("{0}", DRC=0)</Value>
</Radiobutton>
<Radiobutton Name="NicDtsSource (DRC)">
<Value>NicDtsSource("{0}", DRC=1)</Value>
</Radiobutton>
</MultiOptionSource>
</Plugin>
</AudioSource>
<AudioSource UniqueID="e44ed4c0-e096-11dc-95ff-0800200c9a66">
<Plugin>
<MultiOptionSource Type="BeHappy.Extensions.MultiOptionSource, BeHappy">
<DialogWidth>250</DialogWidth>
<TitleFormatString>Nic{0}</TitleFormatString>
<LoadAvsPlugin>nicaudio.dll</LoadAvsPlugin>
<SupportedFileExtension>pcm</SupportedFileExtension>
<SupportedFileExtension>lpcm</SupportedFileExtension>
<Script>%options%</Script>
<Radiobutton Name="LPCM BluRay 48000Hz, 16int, 2ch">
<Value>NicLPCMSource("{0}", 48000, -16, 2)</Value>
</Radiobutton>
<Radiobutton Name="LPCM BluRay 48000Hz, 24int, 2ch">
<Value>NicLPCMSource("{0}", 48000, -24, 2)</Value>
</Radiobutton>
<Radiobutton Name="LPCM BluRay 48000Hz, 16int, 6ch">
<Value>NicLPCMSource("{0}", 48000, -16, 6)</Value>
</Radiobutton>
<Radiobutton Name="LPCM BluRay 48000Hz, 24int, 6ch">
<Value>NicLPCMSource("{0}", 48000, -24, 6)</Value>
</Radiobutton>
<Radiobutton Name="LPCM BluRay 48000Hz, 16int, 8ch">
<Value>NicLPCMSource("{0}", 48000, -16, 8)</Value>
</Radiobutton>
<Radiobutton Name="LPCM BluRay 48000Hz, 24int, 8ch">
<Value>NicLPCMSource("{0}", 48000, -24, 8)</Value>
</Radiobutton>
<Radiobutton Name="LPCM 48000Hz, 16int, 2ch">
<Value>NicLPCMSource("{0}", 48000, 16, 2)</Value>
</Radiobutton>
<Radiobutton Name="LPCM 48000Hz, 20int, 2ch">
<Value>NicLPCMSource("{0}", 48000, 20, 2)</Value>
</Radiobutton>
<Radiobutton Name="LPCM 48000Hz, 24int, 2ch">
<Value>NicLPCMSource("{0}", 48000, 24, 2)</Value>
</Radiobutton>
<Radiobutton Name="LPCM 48000Hz, 16int, 6ch">
<Value>NicLPCMSource("{0}", 48000, 16, 6)</Value>
</Radiobutton>
<Radiobutton Name="LPCM 48000Hz, 20int, 6ch">
<Value>NicLPCMSource("{0}", 48000, 20, 6)</Value>
</Radiobutton>
<Radiobutton Name="LPCM 48000Hz, 24int, 6ch">
<Value>NicLPCMSource("{0}", 48000, 24, 6)</Value>
</Radiobutton>
<Radiobutton Name="LPCM 44100Hz, 16int, 2ch">
<Value>NicLPCMSource("{0}", 44100, 16, 2)</Value>
</Radiobutton>
<Radiobutton Name="LPCM 44100Hz, 20int, 2ch">
<Value>NicLPCMSource("{0}", 44100, 20, 2)</Value>
</Radiobutton>
<Radiobutton Name="LPCM 44100Hz, 24int, 2ch">
<Value>NicLPCMSource("{0}", 44100, 24, 2)</Value>
</Radiobutton>
<Radiobutton Name="LPCM 44100Hz, 16int, 6ch">
<Value>NicLPCMSource("{0}", 44100, 16, 6)</Value>
</Radiobutton>
<Radiobutton Name="LPCM 44100Hz, 20int, 6ch">
<Value>NicLPCMSource("{0}", 44100, 20, 6)</Value>
</Radiobutton>
<Radiobutton Name="LPCM 44100Hz, 24int, 6ch">
<Value>NicLPCMSource("{0}", 44100, 24, 6)</Value>
</Radiobutton>
</MultiOptionSource>
</Plugin>
</AudioSource>
<AudioSource UniqueID="58ab9132-50c8-11dc-8314-0800200c9a66">
<Plugin>
<MultiOptionSource Type="BeHappy.Extensions.MultiOptionSource, BeHappy">
<DialogWidth>250</DialogWidth>
<TitleFormatString>Nic{0}</TitleFormatString>
<LoadAvsPlugin>nicaudio.dll</LoadAvsPlugin>
<SupportedFileExtension>raw</SupportedFileExtension>
<SupportedFileExtension>dat</SupportedFileExtension>
<SupportedFileExtension>wav</SupportedFileExtension>
<SupportedFileExtension>w64</SupportedFileExtension>
<SupportedFileExtension>aif</SupportedFileExtension>
<SupportedFileExtension>au</SupportedFileExtension>
<SupportedFileExtension>caf</SupportedFileExtension>
<SupportedFileExtension>bwf</SupportedFileExtension>
<Script>%options%</Script>
<Radiobutton Name="RaWav IgnoreLength always">
<Value>RaWavSource("{0}", 1)</Value>
</Radiobutton>
<Radiobutton Name="RaWav IgnoreLength if wav > 2GB">
<Value>RaWavSource("{0}", 2)</Value>
</Radiobutton>
<Radiobutton Name="RaWav IgnoreLength if wav > 4GB">
<Value>RaWavSource("{0}", 4)</Value>
</Radiobutton>
<Radiobutton Name="RaWav 48000Hz, 16int, 2ch">
<Value>RaWavSource("{0}", 48000, 16, 2)</Value>
</Radiobutton>
<Radiobutton Name="RaWav 48000Hz, 24int, 2ch">
<Value>RaWavSource("{0}", 48000, 24, 2)</Value>
</Radiobutton>
<Radiobutton Name="RaWav 48000Hz, 32int, 2ch">
<Value>RaWavSource("{0}", 48000, 32, 2)</Value>
</Radiobutton>
<Radiobutton Name="RaWav 48000Hz, 32float, 2ch">
<Value>RaWavSource("{0}", 48000, 33, 2)</Value>
</Radiobutton>
<Radiobutton Name="RaWav 48000Hz, 16int, 6ch">
<Value>RaWavSource("{0}", 48000, 16, 6)</Value>
</Radiobutton>
<Radiobutton Name="RaWav 48000Hz, 24int, 6ch">
<Value>RaWavSource("{0}", 48000, 24, 6)</Value>
</Radiobutton>
<Radiobutton Name="RaWav 48000Hz, 32int, 6ch">
<Value>RaWavSource("{0}", 48000, 32, 6)</Value>
</Radiobutton>
<Radiobutton Name="RaWav 48000Hz, 32float, 6ch">
<Value>RaWavSource("{0}", 48000, 33, 6)</Value>
</Radiobutton>
<Radiobutton Name="RaWav 44100Hz, 16int, 2ch">
<Value>RaWavSource("{0}", 44100, 16, 2)</Value>
</Radiobutton>
<Radiobutton Name="RaWav 44100Hz, 24int, 2ch">
<Value>RaWavSource("{0}", 44100, 24, 2)</Value>
</Radiobutton>
<Radiobutton Name="RaWav 44100Hz, 32int, 2ch">
<Value>RaWavSource("{0}", 44100, 32, 2)</Value>
</Radiobutton>
<Radiobutton Name="RaWav 44100Hz, 32float, 2ch">
<Value>RaWavSource("{0}", 44100, 33, 2)</Value>
</Radiobutton>
<Radiobutton Name="RaWav 44100Hz, 16int, 6ch">
<Value>RaWavSource("{0}", 44100, 16, 6)</Value>
</Radiobutton>
<Radiobutton Name="RaWav 44100Hz, 24int, 6ch">
<Value>RaWavSource("{0}", 44100, 24, 6)</Value>
</Radiobutton>
<Radiobutton Name="RaWav 44100Hz, 32int, 6ch">
<Value>RaWavSource("{0}", 44100, 32, 6)</Value>
</Radiobutton>
<Radiobutton Name="RaWav 44100Hz, 32float, 6ch">
<Value>RaWavSource("{0}", 44100, 33, 6)</Value>
</Radiobutton>
</MultiOptionSource>
</Plugin>
</AudioSource>
</BeHappy.Extension>
tebasuna51
25th June 2021, 10:43
Very interesting all this, could the option to activate / deactivate DRC be formally included in BeHappy?
BeHappy was make to transcode audio, not to play, then the default is don't apply the DRC, but pressing the Configure... button you can use some NicAudio options, see the attached image.
This is included formally in Behappy in s_NicAudio.ext:
...
<MultiOptionSource Type="BeHappy.Extensions.MultiOptionSource, BeHappy">
<DialogWidth>200</DialogWidth>
<TitleFormatString>{0}</TitleFormatString>
<LoadAvsPlugin>nicaudio.dll</LoadAvsPlugin>
<SupportedFileExtension>ac3</SupportedFileExtension>
<Script>%options%</Script>
<Radiobutton Name="NicAc3Source">
<Value>NicAc3Source("{0}")</Value>
</Radiobutton>
<Radiobutton Name="NicAc3Source (DRC)">
<Value>NicAc3Source("{0}", DRC=1)</Value>
</Radiobutton>
<Radiobutton Name="NicAc3Source (Down2)">
<Value>NicAc3Source("{0}", 2)</Value>
</Radiobutton>
<Radiobutton Name="NicAc3Source (Down2, DRC)">
<Value>NicAc3Source("{0}", 2, DRC=1)</Value>
</Radiobutton>
</MultiOptionSource>
Of course you can activate these options in your scripts like you can read in the wiki (http://avisynth.nl/index.php/NicAudio)
Edit: could activating DRC be done in compression mode given certain parameters? I have this doubt aside.
If you talk about free AC3 encoders (Aften, ffmpeg) the answer is nope. You need any commercial Dolby encoders.
The DRC present in AC3 stream was needed longtime ago when AVR's aren't with power process.
Now the AVR's can do DRC on the fly with functions like 'Night mode' and not only over AC3 streams.
Then DRC in streams are useless now.
-QfG-
25th June 2021, 19:28
DRC (Dynamic Range Compression) is a Decoder thing, not Encoder thing. DRC is an information in the AC3 Audio File. FFMPEG can delete this information with the FFMPEG Decoder (-drc_scale 0). But now the problem, if u work with a frameserver and tunneling your AVS script, FFMPEG cannot decode the AC3 file, you must do this with the frameserver, btw. indexer. NicAudioSource is the only indexer i found, that can do this. So i can't encode an audio file directly from a container without DRC. I have created a batch script for this operation. But i will check FFAudioSource, i hope this has an DRC0 function.
This is included formally in Behappy in s_NicAudio.ext
I have not testet this, i've forced DRC OFF with the ", DRC=0" Switch and this works fine for me.
Please explain me how, because BeHappy generate TimestretchPlugin() calls (to Timestretch.dll 2015 Wilbert) but Timestretch.dll avs+ need calls with only Timestretch() like internal Timestretch functions in standard avs.
I have downloaded the sourcecode from Github and modified it. Here is my compiled updated BeHappy with Avisynth 3.7.x Support (https://1fichier.com/?w4hxlyrqfqmxwv3c0gvt).
Could DRC be applied to any type of audio with BeHappy, if possible with parameters, that is, not only automatically?
Nope, only AC3 files can be DRC compressed. I don't know why BeHappys NicDTSSource has the DRC Parameter.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.