Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
20th June 2021, 22:13 | #1 | Link |
QfG Group Germany
Join Date: Oct 2018
Location: Germany
Posts: 245
|
AC3 DRC0 via Avisynth Script
Hi there,
has anybody an idea how i can erase the DRC from AC3 Files via Avisynth? I know that i can remove DRC with FFMPEG, but i need help with this function via Avisynth. If i use an Avisynth script via FFMPEG, FFMPEG skips this line.
__________________
|
21st June 2021, 09:20 | #2 | Link |
Registered User
Join Date: Jul 2003
Location: Italy
Posts: 1,135
|
Since Avisynth doesn't touch the original source, your best bet is to use nicsource as ac3 decoder and set drc to zero. This will ignore that flag. If you can use something else, you can use eac3to which will set dialnorm to -31 (which means "don't do anything"). As far as I know, ffmpeg decoding of ac3 files is subpar, since the volume will be very different from the source, even if drc is set to zero. I don't know how this translates with source filters like lsmash or libav...
|
22nd June 2021, 14:07 | #3 | Link |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,890
|
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() Code:
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) 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() Added Feature request for BestAudioSource() I don't know where add Feature request for LWLibavAudioSource() because https://forum.doom9.org/showthread.p...08#post1943308
__________________
BeHappy, AviSynth audio transcoder. Last edited by tebasuna51; 23rd June 2021 at 22:38. Reason: Add info |
24th June 2021, 20:01 | #5 | Link |
QfG Group Germany
Join Date: Oct 2018
Location: Germany
Posts: 245
|
So, i have found a solution for me, many thanks for the response and the idea with NICDTS Source.
I have downloaded the sourcecode from BeHappy and i have modified some things for me. Also i have integrated the newest Timestretch Plugin from Avisynth+ 3.7.0. Now i can make DRC0 audio files from ac3 files, i'm searching for a container solution, too. But it's a step forward: The Red one is the AC3 File without DRC!
__________________
Last edited by -QfG-; 26th June 2021 at 13:50. |
24th June 2021, 22:24 | #6 | Link |
Registered User
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 744
|
Very interesting all this, could the option to activate / deactivate DRC be formally included in BeHappy?
Edit: could activating DRC be done in compression mode given certain parameters? I have this doubt aside. |
25th June 2021, 02:35 | #7 | Link |
QfG Group Germany
Join Date: Oct 2018
Location: Germany
Posts: 245
|
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. Code:
<?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>
__________________
|
25th June 2021, 10:43 | #8 | Link | |||
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,890
|
Quote:
This is included formally in Behappy in s_NicAudio.ext: Quote:
Quote:
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.
__________________
BeHappy, AviSynth audio transcoder. Last edited by tebasuna51; 25th June 2021 at 10:55. Reason: add info |
|||
25th June 2021, 12:18 | #9 | Link | ||
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,890
|
Quote:
Quote:
__________________
BeHappy, AviSynth audio transcoder. Last edited by tebasuna51; 25th June 2021 at 12:35. |
||
25th June 2021, 16:12 | #10 | Link |
Registered User
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 744
|
Thank you both for your answers. Since I hardly used my PC in these last years I still feel rusty on some things, I need to review / learn and update myself on these things.
tebasuna, one of the things that I wanted to improve is to apply compression to audios with abrupt changes in volume, as in movies, what several cable channels (at least in Latin America) do (is what I notice). I have done this with Adobe Audition but I feel it can be done even better, maybe in BeHappy. So my question: Could DRC be applied to any type of audio with BeHappy, if possible with parameters, that is, not only automatically? |
25th June 2021, 19:28 | #11 | Link | |||
QfG Group Germany
Join Date: Oct 2018
Location: Germany
Posts: 245
|
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.
Quote:
Quote:
Quote:
__________________
Last edited by -QfG-; 25th June 2021 at 19:31. |
|||
25th June 2021, 21:11 | #12 | Link |
Registered User
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 744
|
Ok, I understand, now I will put my request in another way, avoiding the term DRC: in Adobe Audition there is a way to compress (or expand) any audio. In the specific case of compression, I would like to know if it is possible in BeHappy to add a compressor for those sounds with large volume variations?
|
25th June 2021, 22:01 | #13 | Link | |||
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,890
|
Still not, I make a feature request in precedent post.
Quote:
Quote:
Quote:
__________________
BeHappy, AviSynth audio transcoder. |
|||
25th June 2021, 23:11 | #14 | Link | |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,890
|
Quote:
You have the SoxFilter, it have some problems but you can try the compand function, for instance some samples here https://forum.doom9.org/showthread.p...165#post779165 But I recommend you use ffmpeg better.
__________________
BeHappy, AviSynth audio transcoder. |
|
26th June 2021, 10:03 | #16 | Link | |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,890
|
Quote:
- Also the compand, like with sox, https://ffmpeg.org/ffmpeg-filters.html#compand , a example here And with selection of frequency bands https://ffmpeg.org/ffmpeg-filters.html#mcompand - A similar compressor (I don't know the sources) https://ffmpeg.org/ffmpeg-filters.html#acompressor - A EBU R128 loudness normalization https://ffmpeg.org/ffmpeg-filters.html#loudnorm - At last, but maybe the recommended, https://ffmpeg.org/ffmpeg-filters.html#dynaudnorm I think is the method created by LoRd_MuldeR explained here and with links to standalone filter.
__________________
BeHappy, AviSynth audio transcoder. |
|
26th June 2021, 11:40 | #17 | Link |
QfG Group Germany
Join Date: Oct 2018
Location: Germany
Posts: 245
|
A little Update of my modified BeHappy Version:
-Output as Dolby TrueHD (LOSLESS) available. https://1fichier.com/?pk9l96pmlzarib9akme2
__________________
|
26th June 2021, 11:59 | #18 | Link | |
Registered User
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 744
|
Quote:
|
|
26th June 2021, 16:06 | #19 | Link | |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,890
|
Quote:
Like I have my install also customized I only replace the BeHappy.exe and is OK. I see you add also the ConvertAudioToFloat() before (needed in Avs+), and can be compatible with Avs 2.61 also. I add a link in BeHappy thread, thanks.
__________________
BeHappy, AviSynth audio transcoder. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|