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.

 

Go Back   Doom9's Forum > General > Audio encoding

Reply
 
Thread Tools Search this Thread Display Modes
Old 11th January 2020, 22:43   #1  |  Link
alexVS
Registered User
 
Join Date: Sep 2004
Posts: 147
Converting AC3 5.1 to stereo with volume adjusting

Long time ago I converted AC3 5.1 to stereo using Graphedit and AC3filter. I could adjust sound so, that dialog and central channel become louder. Like in picture.

But now WAVDEST.AX dated 1998 year old, It's kind of scary to install codecs 20+ years old. And AC3filter is not required in system, i use LAV decoder.

How can I fast transcode audio 5.1 to stereo using something modern, fast, may be portable. I tried BeHappy, but it's difficult, and I can't find right coefficients for avisynth Mixaudio and Mergechannels.

I just need to convert AC3 5.1 to WAV Stereo, boosting central channel with speech, and lowering special effects, that are usually in SL, SR channel. And may be mute LFE sounds. And speed matters, because demuxing all to 6 wav, editing volume in soundforge , encoding and muxing back is very time consuming.

Can ffmpeg or eac3to help with it? or something other? Help, please!
Attached Images
  

Last edited by alexVS; 11th January 2020 at 22:47.
alexVS is offline   Reply With Quote
Old 12th January 2020, 04:18   #2  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
If you use LAV Audio decoder then you can enable its mixing feature. Set the mixing target to Stereo, you can control the levels for the center channel, surround channels and LFE.

The other option I use all the time lets AviSynth do the work. Use this function: (by Tebasuna)
Quote:
Function Dmix6Stereo(clip a)
{
flr = GetChannel(a, 1, 2)
fcc = GetChannel(a, 3, 3)
lrc = MixAudio(flr, fcc, 0.3694, 0.2612)
blr = GetChannel(a, 5, 6)
return MixAudio(lrc, blr, 1.0, 0.3694)
}
and adjust the coefficients in bold to your liking (LFE is not used by default).

If you want the LFE channel in the downmix use this function:
Quote:
Function Dmix6StereoLfe(clip a)
{
flr = GetChannel(a, 1, 2)
fcc = GetChannel(a, 3)
lfe = GetChannel(a, 4)
lfc = MixAudio(fcc, lfe, 0.2071, 0.2071)
mix = MergeChannels(lfc, lfc)
lrc = MixAudio(flr, mix, 0.2929, 1.0)
blr = GetChannel(a, 5, 6)
return MixAudio(lrc, blr, 1.0, 0.2929)
}

Last edited by manolito; 12th January 2020 at 04:31.
manolito is offline   Reply With Quote
Old 12th January 2020, 11:31   #3  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
Quote:
Originally Posted by alexVS View Post
Long time ago I converted AC3 5.1 to stereo using Graphedit and AC3filter. I could adjust sound so, that dialog and central channel become louder. Like in picture...
In your picture seems the Center channel at high volume and low volume for surround channels. Maybe you can try a avs mix like:

Quote:
Function Dmix6Stereo(clip a) {
flr = GetChannel(a, 1, 2)
fcc = GetChannel(a, 3, 3)
lrc = MixAudio(flr, fcc, 0.4, 0.4)
blr = GetChannel(a, 5, 6)
return MixAudio(lrc, blr, 1.0, 0.2)
}
- The 3 coeficients must sum 1.0 to avoid clip.
- Like the C channel is present in L and R output channels the volume is equivalent to 0.8

You can use also ffmpeg with:
Quote:
ffmpeg -drc_scale 0 -i "input.ac3" -af "pan=stereo|FL < .4FL + .4FC + .2SL|FR < .4FR + .4FC + .2SR" -acodec pcm_s24le "output.wav"
or recode to AAC, AC3, ...

EDIT: if you have the UsEac3to GUI with ffmpeg and qaac:
Attached Images
 
__________________
BeHappy, AviSynth audio transcoder.

Last edited by tebasuna51; 12th January 2020 at 11:58.
tebasuna51 is offline   Reply With Quote
Old 12th January 2020, 21:47   #4  |  Link
Richard1485
Guest
 
Posts: n/a
Quote:
Originally Posted by manolito View Post
Function Dmix6Stereo(clip a)
{
flr = GetChannel(a, 1, 2)
fcc = GetChannel(a, 3, 3)
lrc = MixAudio(flr, fcc, 0.3694, 0.2612)
blr = GetChannel(a, 5, 6)
return MixAudio(lrc, blr, 1.0, 0.3694)
}
Quote:
Originally Posted by tebasuna51 View Post
You can use also ffmpeg with:

ffmpeg -drc_scale 0 -i "input.ac3" -af "pan=stereo|FL < .4FL + .4FC + .2SL|FR < .4FR + .4FC + .2SR" -acodec pcm_s24le "output.wav"
So, to make the first downmix that manolito posted, it's like this in ffmpeg:
Quote:
ffmpeg -drc_scale 0 -i "input.ac3" -af "pan=stereo|FL < .3694FL + .3694FC + .2612SL|FR < .3694FR + .3694FC + .2612SR" -acodec pcm_s24le "output.wav"
Is that right?
  Reply With Quote
Old 13th January 2020, 03:50   #5  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
Nope:

MixAudio(flr, fcc, 0.3694, 0.2612)
MixAudio(lrc, blr, 1.0, 0.3694)

ffmpeg -drc_scale 0 -i "input.ac3" -af "pan=stereo|FL < .3694FL + .2612FC + .3694SL|FR < .3694FR + .2612FC + .3694SR" -acodec pcm_s24le "output.wav"
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 13th January 2020, 11:53   #6  |  Link
Fluffbutt
Registered User
 
Join Date: Aug 2004
Posts: 55
I use this with success

Quote:
D:\Downloads\ffmpeg.exe -hide_banner -i %1 -threads 8 -map 0:a:0 -f mp3 -acodec mp3 -b:a 128k -ac 2 -af pan=stereo:FL=0.25*FL+FC+0.6*LFE:FR=0.25*FR+FC+0.6*LFE -af "volume=0.01dB" "%~dp1%~n1.mp3"
The volume = numbers comes from

Quote:
D:\Downloads\ffmpeg.exe -hide_banner -i %1 -threads 8 -af volumedetect -f null -
pause
Just copy the number af6ter "max_volume", without the minus sign... max_volume: -3.2db becomes 3.2 in that top cmd file (nb, they are both cmd files that you drag and drop the film or audo mka file onto.

My standard procedure:

mux out the audio to mka with mkvtoolnix.
drop xyz.mka onto the second cmd (my first file used)
edit the top cmd line to have the right number dB, save file
drop mka onto that cmd file
remux with mkvtoolnix, delete original audio, select my new mp3.

Of course, edit the bitrate to suit yourself.

And... anyone know how to go through the ffmpeg output and auto select that "3.2" number then send it to the second file (or down the line in one cmd file)?
Everything I've tried (from the various techy forums) has not worked.

(^ that's not a hijack, it'll benefit us all if I can find it to make it one drag and drop job.
__________________
|
Meeow!
Fluffbutt is offline   Reply With Quote
Old 13th January 2020, 17:36   #7  |  Link
alexVS
Registered User
 
Join Date: Sep 2004
Posts: 147
Thanks a lot! This works wonderfull:
Quote:
ffmpeg -drc_scale 0 -i "sound.ac3" -af "pan=stereo|FL < .4FL + .4FC + .2SL|FR < .4FR + .4FC + .2SR" -acodec ac3 -b:a 192k "sound_output.ac3"
I'm not sure about avisynth. Must I open AC3 with DirectShowSource or NicAC3Source?
And DRC paramerer must be 0 or 1?
Quote:
LoadPlugin("D:\program files\avisynth 2.5\plugins\NicAudio.dll")

Function Dmix6Stereo(clip a)
{
flr = GetChannel(a, 1, 2)
fcc = GetChannel(a, 3, 3)
lrc = MixAudio(flr, fcc, 0.4, 0.4)
blr = GetChannel(a, 5, 6)
return MixAudio(lrc, blr, 1.0, 0.2)
}
a = NicAC3Source("sound.ac3", DRC=1)
a1 = ConvertAudioToFloat(a) # Not sure if I need this line and what this line does
Dmix6Stereo(a1)
#Convertaudioto16() # not needed to encode to ac3/aac
alexVS is offline   Reply With Quote
Old 13th January 2020, 17:55   #8  |  Link
Richard1485
Guest
 
Posts: n/a
Quote:
Originally Posted by tebasuna51 View Post
Nope:
Thanks for the correction! I muddled up the order of the coefficients.
  Reply With Quote
Old 13th January 2020, 23:11   #9  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
Quote:
Originally Posted by alexVS View Post
I'm not sure about avisynth.
Better use ffmpeg.

Quote:
Must I open AC3 with DirectShowSource or NicAC3Source?
Never use DirectShowSource, NicAC3Source is Ok (also ffms2 or L-SMASH)

Quote:
And DRC paramerer must be 0 or 1?
Use the default (0) like with ffmpeg (-drc_scale 0)

The NicAC3Source (or FFAudioSource, or LWLibavAudioSource) output is already float (audio samples are 32 bit float), ConvertAudioToFloat do nothing.
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Reply

Tags
ac3, convert, stereo, volume, wav

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:21.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.