View Single Post
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