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 21st November 2005, 17:49   #1  |  Link
Rockaria
nobody's nobody
 
Join Date: Mar 2005
Location: The Sun, somewhere around
Posts: 553
Another flexible and extensible way of multi channel audio encoding using Avisynth.

The foobar2k v0.83 has been stable(in 6ch decoding & encoding) until nero released the nero 7 with different channel mapping(!) and realizing the next version of foobar has been in beta state very long. The videolan supports variety of formats of decoding but somewhat lacks in bitrates and formats for encoding. The ffdshow is only good for wav, ac3 and some few other format dsfilter encoders. And other tools require lots of broken steps and spaces until to get the final results, which is where we are asking desperately for good feature-rich flexible comprehensive integrated tools.

While reviewing the Avisynth section, thread by thread, I found there already have been good efforts and solutions for multichannel audio encoding for variety of effects and formats which only requires some integrations. The avs2wav is an avsynth client application which can toss multi channel WAV stream to other pipe capable encoders and the avisynth can perform some basic functionalities such as channel remapping and volume gaining. The avisynth can also read virtually all the formats through own plugins, dsfilters and graphedit files. For an example you need the graphedit .grf file to feed to serve the audio frame(dtsac3 source-> ffdshow to decode the dts signal in the dtswav). But for DTS files you cannot use the directshow filter directly or indirectly because of the wrong 48k sample rate information for 44.1k 6ch streams(don't know which tool is responsible), which require the NIC's plugin to be used. Also you may need a hexeditor to extract some blocks of preceding filler(after the header) to make the dtswav decoders(videolan, foobar, ffdshow) seek properly.

Below are the tools and scripts required for my tests encoding with correct channel mappings for different decoders and encoders. The 6ch ac3 speaker test file would be useful to identify the channels correctly by playing the avs script using MPC or any dsfilter enabled players. The encoders are in the same folder and the avsynth plugins are installed in its own plugin folder.
The launcher user interface(shell or gui) wouldn't be that hard to make, for those who transcode a lot, which is left for who actually need it while I am more focused on the existing and ever-growing features of avisynth.

My poor ears cannot find any differnce between vbr he q6 and q8(forced) of nero aacenc, except the result file size..
And the v7 aacenc32.dll is almost half the size of the latest v6 version, which looks like nero excluded all the test routines or actually OPTIMIZED it?(no it requires mfc71.dll).

<6ch cli encoders supporting stdin>
http://www.saunalahti.fi/~cse/files/naac.zip : used with aac.dll & aacenc32.dll of nero 6/7 in the nero plugin directory, can be overrided by local placement
http://www.free-codecs.com/download/FLAC.htm : better space usage than wav
http://www.free-codecs.com/download/Vorbis.htm : no good results for me
http://www.free-codecs.com/download/WavPack.htm : lossy/lossless
...

<avisynth related>
http://www.avisynth.org/ : channel mapping, mixing, volume gain control, resampling...
http://www.avisynth.org/warpenterpri...l_20050704.zip : ac3, dts, mpa ..
http://home.pages.at/kassandro/avs2wav.rar : 6ch std/wav out
...

<graphedit related>
http://home.comcast.net/%7eappleguru...ctober2004.zip : decoding, encoding, DSPs
http://www.free-codecs.com/download/...rce_Filter.htm : dts,ac3 source filter
http://fin.afterdawn.com/ohjelmat/vi...it/ffdshow.cfm : decoding(includes dtswav), channel mapping, volume gain, ac3 encoding, resampling, up/down mixing and some DSPs
...

<other useful files>
http://www.needfulthings.host.sk/tools : WaveWizard v0.54b and many good tools...
http://jsoto.posunplugged.com/audiotools.htm : multiwav_1001_exe.zip delaycut_1204_exe.zip
http://www.seemoredigital.net/51_Tes...est_Files.html : AC3 - 6Ch 'Speaker Test'.7z for setting up the channel orders
http://www.free-codecs.com/download/...er_Classic.htm : for playing avs scripts.
http://www.hiddensoft.com/autoit3/ : an easy gui script programming
http://www.mlin.net/misc.shtml : PathCopyEx.msi, RegSvrEx.zip
and doom9's Avisynth section
...
other recent resources : Sox Filter, ffmpeg, Lame...

<aac.avs> : avs script
Quote:
#a=DirectShowSource("C:\a n y\Ds Filter.wma")
#DirectShowSource("c:\44.1k\DtsWav.WAV")
#DirectShowSource("GraphEdit.GRF")
#NicDTSSource("DtsMusic.DTS")
NicAC3Source("DdMusic.AC3")
#GetChannel(a,2,3,1,6,4,5).SSRC(48000).Normalize()
GetChannel(a,2,3,1,6,4,5)
#SSRC(48000)
Normalize()

#below are temporary fix for avs2wav : use SSRC if the 44.1k streaming is pending
#SSRC(48000).SSRC(44100)
#AudioDubEx(Trim(Colorbars(320,240),0,1),last)
<avs2aac.cmd> : simple encoding shell script
Quote:
avs2wav.exe aac.avs - | naac -profile he -vbr 8 - 8.m4a
rem avs2wav aac.avs avs2wav.wav
rem MakeAVIS.exe -i aac.avs -a makeavis.wav

rem ---somebody might be able to enable the flexibility of behappy using IMPORT() & || *.avsi
rem bepipe.exe --script "import(^ogg2ch.avs^)" | oggenc2.exe -q5 - -o 2.ogg
rem bepipe.exe --script "import(^aac6ch.avs^)" | naac -profile he -vbr 5 - 6.m4a
<enc.cmd> : simple launcher
Quote:
rem START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
rem [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
rem [/WAIT] [/B] [command/program]
start "avs2aac" /LOW avs2aac.cmd
<<implementations>>
<tools>
. kasandro's avs2wav : original , simple and basic
. dimzon's behappy : gui replacement of avs2wav, heavily dimzoned, lost some flexibility & transparency
. bepipe : a temporary conversion of avs2wav, single command line interface, maybe still usable.
...
<DSP functions & scripts>
..
. tebasuna51's original DPL II function with a bit different overall matrix balance.
. MiCK76's DPL II encoder function based on azid? with volume reduced matrix of FFDShow
. Rockaria's DPL II encoder functions based on FFDShow's model, still not the perfect DPL II decoding though
. Rockaria's UPMIX/DPLII encoding examples in CLI mode using avs2wav and bepipe

. tebasuna51's DRC macro based on sox plugin
. NorthPole's 6ch upmix macro

[hostory]
...
xxx xx 2006 : a clarification of the required nero dlls.
Feb 17 2006 : added the implementations on the bottom.
Feb 19 2006 : added a script example using bepipe & avs2wav, modified some script example here.
Feb 20 2006 : Closure.
__________________
u know everything in the end, or now if aligned... no right(x).right(y) pls. it's confusing... : phase-shift /Jun.2006

Last edited by Rockaria; 21st February 2006 at 00:18.
Rockaria is offline   Reply With Quote
Old 21st November 2005, 18:37   #2  |  Link
SeeMoreDigital
Life looks better in HD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 11,171
Have you actually been able to generate 6Ch AAC files using Foobar2000 with Nero7 filters?

I have not installed Nero7 yet and can't see the point in doing so until they provide a separate NeroDigital only packages.

If you have managed to do it with Foobar2000. Can you generate an 6Ch AAC encode, using the "6Ch AC3 Speaker Test file" that can be found on my web site and e-mail it to me please?


Iyyyyy thank-you
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 21st November 2005, 20:50   #3  |  Link
Rockaria
nobody's nobody
 
Join Date: Mar 2005
Location: The Sun, somewhere around
Posts: 553
I corrected some small mistypings and YES i've tested the aac(mp4,m4a) encoding with foo_naac.dll/foo_nero.dll/naac.exe and version 6/7 of aacenc32.dlls. It's easy to detect the difference although I am not sure which is causing it : foobar encloder plugins/cli or nero encoders. When I used the above described method, both v6 and v7 of nero encoder dlls reqired the same channel mappings. Maybe the foobar aac encode-interface routine is checking the nero dll version(i.e. to be v6)?

For your own prompt verification (I am off the test machine ), I think you can install the trial version on any computer and copy the aacenc32.dll from the program files nero common folder to the local script folder to override the existing nero dlls until you get the nero digital, recode 2 or any seperate version equivalent to v7.
Rockaria is offline   Reply With Quote
Old 21st November 2005, 20:57   #4  |  Link
SeeMoreDigital
Life looks better in HD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 11,171
Bummer!

In that case I wonder if anybody else could oblige?


Cheers
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 21st November 2005, 21:34   #5  |  Link
Rockaria
nobody's nobody
 
Join Date: Mar 2005
Location: The Sun, somewhere around
Posts: 553
Don't be disappointed SeeMoreDigital!
Meanwhile(until I get home), you can check this thread to get other's experience.
In case you still need the proof, I can happily email the result later.
Rockaria is offline   Reply With Quote
Old 21st November 2005, 21:51   #6  |  Link
SeeMoreDigital
Life looks better in HD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 11,171
Quote:
Originally Posted by Rockaria
Don't be disappointed SeeMoreDigital!
Meanwhile(until I get home), you can check this thread to get other's experience.
In case you still need the proof, I can happily email the result later.
Yes... I've read this thread (and even taken part)....

Once set-up, Foobar2000 usually makes very light work of re-encoding and correctly mapping 6Ch AC3 to 6Ch AAC. So I'm curious to know how the streams are mapped.
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 21st November 2005, 23:28   #7  |  Link
Rockaria
nobody's nobody
 
Join Date: Mar 2005
Location: The Sun, somewhere around
Posts: 553
I agreed the foobar2k v0.83 had been very satisfactory with the decent multi-channel aac encodings and I actually liked it(and it's gui!).
But I have no idea about the nero's strategy on the v7 aac encoder but am sure the channel mapping is different from the old stable setup and found there is an alternate & more flexible method as I described above.

Now the foobar2k beta 0.9 version stdinput plugin read the aac stream correctly and we may be having the correct channel mappings interface from the v0.9 regardless of the nero aac encoder version.
My feeling is that the foobar nero aac encoder interface is somewhat hardcoding the channel order somewhere inside. What I've been missing with the foobar is an explicit channel remapping plugin for the flexibility.

Also I think the stream passing between the dlls would be somewhat faster than between the processors through pipe, but not that significantly in processing and the lightweight feature seems to be more from the user interface than the actual processing. The above method uses only two EXEs and some DLLs, less than 3 maybe including the avisynth.dll itself, also it would be worthwhile to check how many dlls and memory are actually used with foobar encoding...

Last edited by Rockaria; 22nd November 2005 at 02:19.
Rockaria is offline   Reply With Quote
Old 22nd November 2005, 11:22   #8  |  Link
SeeMoreDigital
Life looks better in HD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 11,171
I know people are excited about the prospect of using Foobar2000 v0.9 but we could get ourselves into a real mess if we don't test Nero's new filters more throughly with Foobar2000 v0.8.3 first


Cheers
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 22nd November 2005, 16:34   #9  |  Link
Rockaria
nobody's nobody
 
Join Date: Mar 2005
Location: The Sun, somewhere around
Posts: 553
Let me remind you this is a thread about a new method practically providing a flexible environment for any type of source and target format with correct channel order, where includes the v7 nero aac encoder.

Actually, as for the foobar2k v0.83, they are all known issue, the only way to encode to nero 6ch aac without channel messup, as well as the only player with the messed up channel order in aac decoding.

What tebasuna51 stated in the link above implies something useful :
Quote:
Using bsn.dll v0.24 by DPeshev,Richard,E-Male,DSPguru (DSPguru.Doom9.org).
or
Using bsn.dll replacement v0.02 by dimzon (dimzon541@gmail.com).
-input FL_FR_C_LFE_SL_SR.wav ... -bsn( -6chnew ... Wrong aac channel mapping
-input Correct.ac3 ... -bsn( -6chnew ... Wrong aac channel mapping
-input FR_C_FL_SR_LFE_SL.wav ... -bsn( -6chnew ... Correct aac channel mapping

Using bse_Nero7WA.dll by dimzon, Build Nov 3 2005, 14:10:28 (latest)
-input FL_FR_C_LFE_SL_SR.wav ... -dimzon( -dllname bse_Nero7WA.dll -6chnew ... Correct aac channel mapping
-input Correct.ac3 ... -dimzon( -dllname bse_Nero7WA.dll -6chnew ... Correct aac channel
The channel order FL_FR_C_LFE_SL_SR looks like for the WAV every decoder should line up to decode or play.
The order FR_C_FL_SR_LFE_SL stands for the remapping a=GetChannel(a,2,3,1,6,4,5) in above script and seems to be the actual channel order for AAC in both nero aac versions.

Then what would be the problem?
Why they needed a new nero7 encoder plugin for besweet?
I guess something hardcoded hidden depending on the aac encoder version.
Rockaria is offline   Reply With Quote
Old 22nd November 2005, 17:44   #10  |  Link
SeeMoreDigital
Life looks better in HD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 11,171
While I understand what you are saying, unfortunately there are many posts on this forum from members asking why there AAC channel orders are messed up!

Some of these channel order problems seem to be associated with people converting AC3 to WAV and then AAC. This approach always waves "red flags" to me, as it opens up two potential places to "cock up" the channel order.

The first "cock-up" area is getting the AC3 to WAV channel mapping right. The second "cock-up" area is getting the WAV to AAC channel mapping right.

As Foobar2000 removes the need to convert to WAV first, it illiminates these two "cock-up" areas!

So until somebody sends me an 6Ch AAC file thats been directly encoded from my 6Ch AC3 source using Foobar2000 v0.8.3 with Nero7's filters, I'm not convinced there's a channel mapping problem!


Cheers
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 22nd November 2005, 18:07   #11  |  Link
Rockaria
nobody's nobody
 
Join Date: Mar 2005
Location: The Sun, somewhere around
Posts: 553
Quote:
Originally Posted by SeeMoreDigital
While I understand what you are saying, ..
The first "cock-up" area is getting the AC3 to WAV channel mapping right. The second "cock-up" area is getting the WAV to AAC channel mapping right.

As Foobar2000 removes the need to convert to WAV first, it illiminates these two "cock-up" areas!
Unfortunately, it seems not. Every trancoding includes these two steps(decoding & encoding) internally or externally.
Hiding things(black box), is what the users cannot control at all, must be used only for something stable or are abused when the author want an everlasting provider position, very opposite to what we are looking for.
Rockaria is offline   Reply With Quote
Old 22nd November 2005, 18:28   #12  |  Link
SeeMoreDigital
Life looks better in HD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 11,171
Quote:
Originally Posted by Rockaria
Unfortunately, it seems not. Every trancoding includes these two steps(decoding & encoding) internally or externally.
Hiding things(black box), is what the users cannot control at all, must be used only for something stable or are abused when the author want an everlasting provider position, very opposite to what we are looking for.
So have you (or anybody else) tried generating an 6Ch AAC encode using my suggested method, or not?

Here's a link to my 6Ch AC3 Speaker Test Sample
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 22nd November 2005, 19:18   #13  |  Link
Rockaria
nobody's nobody
 
Join Date: Mar 2005
Location: The Sun, somewhere around
Posts: 553
Quote:
Originally Posted by Rockaria
YES i've tested the aac(mp4,m4a) encoding with foo_naac.dll/foo_nero.dll/naac.exe and version 6/7 of aacenc32.dlls
In case you still need the proof,..

Let me remind you this is a thread about a new method..

What tebasuna51 stated in the link above implies something useful ..
Why they needed a new nero7 encoder plugin for besweet?

..are abused when the author want an everlasting provider position, very opposite to what we are looking for.
Quote:
Originally Posted by SeeMoreDigital
Yes... I've read this thread (and even taken part)....
My suggestion :
<Now it's your thread.> or <Has anybody tried the introduced method and found anything to be improved?> It has lots of potentials...
Rockaria is offline   Reply With Quote
Old 22nd November 2005, 19:29   #14  |  Link
SeeMoreDigital
Life looks better in HD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 11,171
I don't want to fall out with you about this Rockaria, I'm simply trying to establish whether you generated an AAC file, using the method I suggested!

You say: "YES i've tested the aac(mp4,m4a) encoding with foo_naac.dll/foo_nero.dll/naac.exe and version 6/7 of aacenc32.dlls" but you did not confirm whether it was with Foobar200 v0.8.3.

If you have... can you please e-mail me the file please?


Cheers
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 22nd November 2005, 19:40   #15  |  Link
Rockaria
nobody's nobody
 
Join Date: Mar 2005
Location: The Sun, somewhere around
Posts: 553
Quote:
Originally Posted by Rockaria
..YES i've tested the aac(mp4,m4a) encoding with foo_naac.dll/foo_nero.dll/naac.exe and version 6/7 of aacenc32.dlls. It's easy to detect the difference although I am not sure which is causing it : foobar encloder plugins/cli or nero encoders. When I used the above described method, both v6 and v7 of nero encoder dlls reqired the same channel mappings. Maybe the foobar aac encode-interface routine is checking the nero dll version(i.e. to be v6)?

For your own prompt verification (I am off the test machine ), I think you can install the trial version on any computer and copy the aacenc32.dll from the program files nero common folder to the local script folder to override the existing nero dlls until you get the nero digital, recode 2 or any seperate version equivalent to v7.
I will try to send you the result even if I believe myself has done the best to explain.

Mutual respects to the anonymous,
Rockaria is offline   Reply With Quote
Old 23rd November 2005, 02:13   #16  |  Link
Rockaria
nobody's nobody
 
Join Date: Mar 2005
Location: The Sun, somewhere around
Posts: 553
OK. let us conclude. I did some more test based on the 6ch ac3 speaker test file I have from nforce 2 speaker setup directory.

naac.exe required two files from nero plugin directory, which can be overrided by the local folder placement : aac.dll and aacenc32.dll.
aac.dll seems to be responsible for the channel lineup from the assigned decoded wav buffer and can be used with any combinations of these two files.

But the channel line ups are different :
.v6 aac.dll : no need for channel remapping : FL_FR_C_LFE_SL_SR or a=GetChannel(a,1,2,3,4,5,6)
.v7 aac.dll : need the channel remapping : FR_C_FL_SR_LFE_SL or a=GetChannel(a,2,3,1,6,4,5)

So the conclusion is :
.nero changed the aac channel order from v7 by mistake or new policy, potentially a big confusion anyway.
.you can use the v6 aac.dll + v7 aacenc32.dll(actual encoder) with existing transcoding environment such as foobar2k v0.83 or besweet.
Rockaria is offline   Reply With Quote
Old 23rd November 2005, 02:30   #17  |  Link
SeeMoreDigital
Life looks better in HD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 11,171
Can you zip up the AAC file and e-mail it to me please?


Cheers
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 23rd November 2005, 03:50   #18  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 5,160
@SeeMoreDigital
I recode to aac your ac3 test file with Foobar2000 v0.8.3, foo_naac, Nero7 and i send you by e-mail.

The aac is wrong channel mapping like with BeSweet and normal bsn.
tebasuna51 is offline   Reply With Quote
Old 23rd November 2005, 08:03   #19  |  Link
Rockaria
nobody's nobody
 
Join Date: Mar 2005
Location: The Sun, somewhere around
Posts: 553
Thanks for being able to finish the side story of nero 7 channel mapping change, roles of these two nero dlls and walkaround by overriding the v6 aac.dll, which does not depreciate the avisynth's flexibility.

I worried about the LFE and corresponding channel behavior by using the v6 aac.dll for v7 encoder. But it turned out to be safe.

Thanks again for your interest in the introduced avisynth method. period.
Rockaria is offline   Reply With Quote
Old 23rd November 2005, 11:20   #20  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 5,160
Sorry, Rockaria, I only want contribute to finish this dialog because I'm interested in your avisynth method, but only to learn (know more about avisynth is in my long todo list).

I like this thread becomes a discussion about your method, but I can't contribute now.
tebasuna51 is offline   Reply With Quote
Reply

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 02:17.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.