View Full Version : Problems with .AAC LC SBR to MP3
sineptaf1218
20th February 2007, 10:01
I have a couple .aac audio files, ive been trying to convert. Ive used every program imaginable, BeSweet, Foobar, Riverpast, I even tried Nero Wave editor to get the .aac to .mp3 If anyone knows of any encode/decode process I can use to get this to an MP3 thanks . The media information for the audio tracks is .AAC LC SBR with 6 channels and a sampling rate of 24Khz. Thanks.
tebasuna51
20th February 2007, 12:40
You need a program with this capabilities:
1) Decode aac-he (= lc + sbr).
2) Downmix the 6 channels to 2 because mp3 only support stereo.
3) Normalize the signal after the downmix. Complement to downmix to guarantee max volume without clipping.
4) Encode to mp3.
BeSweet don't support aac input and can't make the downmix with other input than ac3.
Foobar can do the job but the downmix-normalize steps aren't perfect. You need convert the aac with a DSP plugin like foo_dsp_downmix.dll (http://www.hydrogenaudio.org/forums/index.php?showtopic=52235&st=0#) (Downmix AC3/DTS) to be Dolby ProLogic II compliant, or foo_dsp_atsurround.dll (http://www.andrewlabs.com/atsurround/downloads.php) with other downmix methods.
Now not easy methods to do the job perfectly:
a) AviSynth method.
The most elegant because don't use intermediate wav files. You need AviSynth v2.5.7 installed and a DS filter to decode aac files like ffdshow activated, to open the aac file with the AviSynth method DirectShowSource().
You can use BeHappy (.NET FrameWork v2 required) a GUI for AviSynth audio or, if you know AviSinth scripts (.avs), Bepipe or the new plugin SoundOut() with a script like:
# 1) aac decoder
a = DirectShowSource("G:\input.aac")
# 2) Downmix dpl II
flr = GetChannel(a, 1, 2)
fcc = GetChannel(a, 3, 3)
lrc = MixAudio(flr, fcc, 0.3254, 0.2301)
bl = GetChannel(a, 5)
br = GetChannel(a, 6)
sl = MixAudio(bl, br, 0.2818, 0.1627)
sr = MixAudio(bl, br, -0.1627, -0.2818)
blr = MergeChannels(sl, sr)
MixAudio(lrc, blr, 1.0, 1.0)
# 3) Normalize
Normalize()
The output can be send to Lame mp3 encoder.
b) Step by step method (with intermediate wav files):
1) Decode aac-he to wav 6 chan.
You can use Foobar, faad or neroAacDec.
2) Downmix wav 6 chan to stereo (dpl II recommended).
You can use WaveWizard:
- First add the downmix method to wavewizard channelmapping:
Open with Notepad or similar the file mappings.ini (in same folder than wavewizard.exe) and add this two lines (copy and paste):
6->2#mix#active#Dolby Prologic II downmix
0.325 0.000 0.000 0.325 0.230 0.230 0.000 0.000 0.282 -0.163 0.163 -0.282
Save mappings.ini (this procedure is needed only first time)
- Open the wav 6 chan
- Menu -> Edit -> Channelmapping (F2). Verify/check the Dolby Prologic II downmix method is the only active.
- Menu -> Edit -> Preferences (F4). Only the following must be checked:
Ignore size in header -> If filesize > 2 GB
Enable channelmapping
Output format -> Wave PCM
- Convert.
3, 4) The last two steps can be make with Belight-BeSweet.
Open the stereo wav from wavewizard, aply -ota( -hybridgain ) to normalize (step 3) and encode to mp3 with your desired parameters.
sineptaf1218
21st February 2007, 08:40
Thanks for your help. I followed the step by step instructions, I now have them on DVD Thanks tebasuna51
TCmullet
9th March 2015, 00:24
Thanks for this! (Even tho it's old.)
I'm relatively new to AviSynth, and all audio from my videos so far has been stereo for me. But have hit a video that is 6-channel AC-3. Is the above code exactly correct for THAT format as well? (Your formula was for Dolby Prologic II, which I'm suspecting is not the same.) It does execute and play, but I don't trust my amateur ears to know if it's correct in all aspects (though it's playable).
foxyshadis
9th March 2015, 05:21
Thanks for this! (Even tho it's old.)
I'm relatively new to AviSynth, and all audio from my videos so far has been stereo for me. But have hit a video that is 6-channel AC-3. Is the above code exactly correct for THAT format as well? (Your formula was for Dolby Prologic II, which I'm suspecting is not the same.) It does execute and play, but I don't trust my amateur ears to know if it's correct in all aspects (though it's playable).
All 6-channel AC3 on DVD (and up) is DPL2, nothing uses DPL1 that I know of, so you're good with this.
TCmullet
9th March 2015, 19:31
All 6-channel AC3 on DVD (and up) is DPL2, nothing uses DPL1 that I know of, so you're good with this.This was captured from cable DVR, not a DVD, but no matter.
Thanks so much, Foxy!
I was wondering, though, as I tried to study the commands while looking them up in the Avisynth docs, your numbers appear to lower the overall volume evidenced by two fractions adding up to way less than 1.00, which you compensate for at the end by Normalizing. Do you have any comments about that? One might have wanted to convert 6 to 2 without normalizing (keeping at original volume). In my case normalizing was a good thing anyway, but I'm just wondering.
hello_hello
9th March 2015, 23:30
I don't bother downmixing to Dolby ProLogic myself. I'm never going to decode it that way, so I just downmix to normal stereo.
To be safe, the volume of each channel needs to be reduced enough so when they're all combined there won't be any clipping. Hence the big volume reduction followed by normalising. Mostly, I use foobar2000 to downmix and convert while reducing the volume. That way, they should all end up the same relative volume to the original, rather than being not so much the same relative volume to the original after peak normalising. I've never been a fan of peak normalising. It's 2015, we put a man on the moon..... blah, blah, blah...... but still no video encoder GUIs use ReplayGain for adjusting audio volume instead of peak normalisation. I do kind of remember one audio conversion program that can apply ReplayGain automatically. I think it was TAudioConverter.
If you want another reference for the numbers, here's how MeGUI does it via Avisynth:
# 5.1 Channels L,R,C,LFE,SL,SR -> Dolby ProLogic II
function c6_dpl2(clip a)
{
fl = GetChannel(a, 1)
fr = GetChannel(a, 2)
fc = GetChannel(a, 3)
sl = GetChannel(a, 5)
sr = GetChannel(a, 6)
ssl = MixAudio(sl, sr, 0.2818, 0.1627)
ssr = MixAudio(sl, sr, -0.1627, -0.2818)
fl_fc = MixAudio(fl, fc, 0.3254, 0.2301)
fr_fc = MixAudio(fr, fc, 0.3254, 0.2301)
l = MixAudio(fl_fc, ssl, 1.0, 1.0)
r = MixAudio(fr_fc, ssr, 1.0, 1.0)
return MergeChannels(l, r)
#5.1 Channels L,R,C,LFE,SL,SR -> stereo + LFE
function c6_stereo(clip a)
{
fl = GetChannel(a, 1)
fr = GetChannel(a, 2)
fc = GetChannel(a, 3)
lf = GetChannel(a, 4)
sl = GetChannel(a, 5)
sr = GetChannel(a, 6)
fl_sl = MixAudio(fl, sl, 0.2929, 0.2929)
fr_sr = MixAudio(fr, sr, 0.2929, 0.2929)
fc_lf = MixAudio(fc, lf, 0.2071, 0.2071)
l = MixAudio(fl_sl, fc_lf, 1.0, 1.0)
r = MixAudio(fr_sr, fc_lf, 1.0, 1.0)
return MergeChannels(l, r)
The above is copied from MeGUI's log file (given I don't use Avisynth for audio conversion much myself and therefore MeGUI knows more about it than I do). If you happen to use ffdshow for audio decoding you'll see it's mixer filter does it the same way when the "normalise matrix" option is checked.
There's a matrix mixer plugin for foobar2000 here. http://skipyrich.com/wiki/Main_Page#Matrix_Mixer_.28foo_dsp_mm.29
It has a "normalise" option but it's the same as ffdshow's "normalise matrix" option. It automatically reduces the individual channel volumes according to how many you're combining as ffdshow does, so the upshot will probably be should also do it the same way as ffdshow/Avisynth, except the "peak normalisation" part needs to be done after the audio is encoded.
Which is fine for MP3 as the volume can be adjusted losslessly. I still tend to use MP3Gain for that part. It's much slower at scanning files than foobar2000 but when it's done you can easily change the target volume and MP3Gain will show you which tracks are clipping. If you've converted with the foobar2000 matrix mixer and it's normalisation option enabled the encoded audio shouldn't be clipped, but MP3Gain will tell you whether it'll clip when it's decoded. You can adjust the target volume up or down, and when all the red "Y's" in the "Max No Clip Gain" column are gone you can tell MP3Gain to adjust the tracks to that target volume, so they'll all be volume adjusted by the same amount.
PS Foobar2000 comes with it's own downmixing DSP. It's called "Downmix channels to stereo" in the list of available DSPs, but it doesn't have a "normalisation matrix" ability (as far as I know) and that means every now and then the audio might be clipped a little as it's downmixed and encoded, so the matrix mixer DSP I linked to earlier is probably a better idea.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.