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. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
21st November 2005, 17:49 | #1 | Link | |||
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:
Quote:
Quote:
<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. |
|||
21st November 2005, 18:37 | #2 | Link |
Life's clearer in 4K UHD
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,219
|
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 |
|
21st November 2005, 20:50 | #3 | Link |
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. |
21st November 2005, 20:57 | #4 | Link |
Life's clearer in 4K UHD
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,219
|
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 |
|
21st November 2005, 21:34 | #5 | Link |
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. |
21st November 2005, 21:51 | #6 | Link | |
Life's clearer in 4K UHD
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,219
|
Quote:
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 |
|
|
22nd November 2005, 19:40 | #7 | Link | |
nobody's nobody
Join Date: Mar 2005
Location: The Sun, somewhere around
Posts: 553
|
Quote:
Mutual respects to the anonymous, |
|
23rd November 2005, 02:13 | #8 | Link |
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. |
23rd November 2005, 02:30 | #9 | Link |
Life's clearer in 4K UHD
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,219
|
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 |
|
23rd November 2005, 08:03 | #11 | Link |
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. |
23rd November 2005, 11:20 | #12 | Link |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,890
|
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. |
23rd November 2005, 16:53 | #13 | Link |
nobody's nobody
Join Date: Mar 2005
Location: The Sun, somewhere around
Posts: 553
|
Well, it's not my method.
I just gathered the related links and provided the minimum environment to start with for multi channel audio encoding with lots of potential. We may find some more pipe-in capable encoders. Or maybe somebody can provide a friendly user interface with job control. It's not daemon server, just a dll starting to provide the decoded a/v stream by any application's call(initially designed for vdub). The script is not like javascript or vbscript, rather a procedure definition language(like RPG), so no if-else-endif. The provided minimum is enough to start with and maybe already surpassing some other integrated tools.. |
19th February 2006, 12:27 | #14 | Link |
nobody's nobody
Join Date: Mar 2005
Location: The Sun, somewhere around
Posts: 553
|
Below is a (enhanced) guide(examples) for those who are using the Avisynth scripts for audio transcoding because of the compatibility requirements of the existing resources(especially for avs2wav). I also found that bepipe(cli)/behappy(gui) can utilize the existing compatible resources using import() method.
Now some side story of the 70/30 or 80/20 rule. . the script based tools are more focused on power user requirements : 20~30% of users are considered using this flexible tool together with other powerful tools such as Sox?... . 70~80% of the users who do not require sophiscated handling, will be satisfied by the existing abundant of GUI tools(winamp, dbpoweramp, foobar2k, Be~tools......) providing patternized processing . my efforts are for some few of the power users who want the flexibility and transparency with Avisynth scripts, in other words the freedom and power...., which is also the basic/essential requirement of any new coming powerful simple tools(with just few hrs or days work). <startEnc.cmd> for anybody who want multi tasking when performing a long transcoding Code:
rem START ["title"] [/Dpath] [/i] [/MIN] [/MAX] [/SEPARATE | /SHARED] rem [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL] rem [/WAIT] [/b] [command/program] start "encoding" /LOW profiles.cmd Code:
rem ---unlock the temporary FIX lines for avs2wav on the BOTTOM of the script avs2wav.exe upmxdpl2.avs - | oggenc2.exe -q5 - -o 2.ogg rem avs2wav.exe ogg6ch.avs - | oggenc2.exe -q5 - -o 6.ogg rem avs2wav.exe aac2ch.avs | naac -profile he -vbr 5 - 2.m4a rem avs2wav.exe aac6ch.avs | naac -profile he -vbr 5 - 6.m4a rem avs2wav.exe aac6chB.avs | naac -profile lc -vbr 8 - 8B.m4a rem ---somebody might be able to fix the flexibility problem of behappy using IMPORT() rem bepipe.exe --script "import(^upmxdpl2.avs^)" | oggenc2.exe -q5 - -o 2.ogg rem bepipe.exe --script "import(^aac6ch.avs^)" | naac -profile he -vbr 5 - 6.m4a rem avs2wav.exe upmxdpl2.avs Code:
import("upmix.avs") import("dpl2enc.avs") DirectShowSource("1.mp3") #NicDTSSource("1.dts") #DirectShowSource("1.m4a") #DirectShowSource("SSWAV06.m4a") #DirectShowSource("DPLII.grf") Amplify(0.92) #AmplifydB(-1.01) convertaudiotofloat() #upmixComedyDrama(last) #upmixActionAdventure(last) upmixBalCenter(last) #upmixIncCenter(last) #upmixDecCenter(last) #upmixGerzen(last) #upmixFarina(last) #upmixMultisonic(last) #upmixSoundOnSound(last) #dpl2FFDA(last) #dpl2FFDLFEA(last) #dpl2FFDA(last, 0.7) dpl2Enc(last, 0.7071, 0.6, 0.866, -0.5, -0.5, 0.866) #dpl2Enc(last, 0.707, 0.4, 0.8165, -0.5774, -0.5774, 0.8165) #dpl2Enc(last, 0.7071, 0.4, 0.866, -0.5, -0.5, 0.866) #dpl2Enc(last, 0.707, 0.4, 0.8165, -0.5774, -0.5774, 0.8165) #ConvertAudioTo16Bit() ConvertAudioTo24Bit() 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) <upmix.avs> a (heavy) reconstruction( for a compatibility) of NorthPole's hardwork. Code:
... function invertFilter(clip a, fv, rv){return invertFilter(a,fv,-1*fv,rv)} function invertFilter(clip a, fv1, fv2, rv){return invertFilter(a,fv1,fv2,rv,-1*rv,"vol -0.5")} function invertFilter(clip a, fv1, fv2, rv1, rv2, lv){ f = a.soxfilter("filter 20-20000") fl = f.GetChannel(1) fr = f.GetChannel(2) r = a.soxfilter("filter 100-7000").DelayAudio(0.02) rl = r.GetChannel(1) rr = r.GetChannel(2) lfe = ConvertToMono(a).SoxFilter("lowpass 120", lv) return MergeChannels(mixaudio(fl,fr,fv1,fv2),mixaudio(fr,fl,fv1,fv2), fl,fr, mixaudio(rl,rr,rv1,rv2),mixaudio(rr,rl,rv1,rv2), lfe) } function upmixComedyDrama(clip a){ # Profile to use with audio sources that have mostly mono content. f = invertFilter(a, 0.794, 0.562) l = f.GetChannel(1) r = f.GetChannel(2) c = mixaudio(mixaudio(f.GetChannel(3),l,1,-1),mixaudio(f.GetChannel(4),r,1,-1),0.224,0.224) return MergeChannels(l,r,c,f.getChannel(7),f.getChannel(5),f.getChannel(6)) } function upmixActionAdventure(clip a){ # Profile to use with audio sources that have a wider range of sound content. 20ms delay and -3db attenuation on surround f = invertFilter(a, 0.668,-0.668, 0.473,-0.473, "vol -0.447") l = f.GetChannel(1) r = f.GetChannel(2) c = mixaudio(mixaudio(f.GetChannel(3),l,1,-1),mixaudio(f.GetChannel(4),r,1,-1),0.398,0.398) return MergeChannels(l, r, c, f.getChannel(7), f.getChannel(5), f.getChannel(6)) } function upmixBalCenter(clip a){ # Balanced approach L' = (L-R)*0.668 R' = (R-L)*0.668 C' = (L-L')*0.398 + (R-R')*0.398 # Profile for general purposes to use with audio sources that have a wide range of sound content f = invertFilter(a, 0.668, 0.531) c = mixaudio(f.GetChannel(3),f.GetChannel(4),0.3980,0.3980) return MergeChannels(f.getChannel(1), f.getChannel(2), c, f.getChannel(7), f.getChannel(5), f.getChannel(6)) } function upmixDecCenter(clip a){ # Balanced approach L' = (L-R)*0.668 R' = (R-L)*0.668 C' = (L-L')*0.398 + (R-R')*0.398 # Profile to use for older movies or videos with mostly mono content. f = invertFilter(a, 0.668,-0.668, 0.531,-0.531, "vol -0.596") l = f.GetChannel(1) r = f.GetChannel(2) c = mixaudio(mixaudio(f.GetChannel(3),l,1,-1),mixaudio(f.GetChannel(4),r,1,-1),0.224,0.224) return MergeChannels(l,r,c,f.getChannel(7),f.getChannel(5),f.getChannel(6)) } function upmixIncCenter(clip a){ # Increased center approach L' = (L-R)*0.596 R' = (R-L)*0.596 C' = (L-L')*0.473 + (R-R')*0.473 # Profile to use with audio sources where quieter dialog or lots of loud sound effects. f = invertFilter(a, 0.596,-0.596, 0.473,-0.473, "vol -0.473") l = f.GetChannel(1) r = f.GetChannel(2) c = mixaudio(mixaudio(f.GetChannel(3),l,1,-1),mixaudio(f.GetChannel(4),r,1,-1),0.473,0.473) return MergeChannels(l,r,c,f.getChannel(7),f.getChannel(5),f.getChannel(6)) } function upmixGerzen(clip a){ # Gerzen approach Profile modified with 20ms delay and some attenuation on surround f = invertFilter(a, 0.885, -0.115, 0.668) c = mixaudio(f.GetChannel(3),f.GetChannel(4),0.4511,0.4511) return MergeChannels(f.getChannel(1),f.getChannel(2),c,f.getChannel(7),f.getChannel(5), f.getChannel(6)) } function upmixMultisonic(clip a){ # Multisonic approach Profile modified with 20ms delay and some attenuation on surround f = invertFilter(a, 0.9,-0.45, 0.596) c = mixaudio(f.GetChannel(3),f.GetChannel(4),0.5000,0.5000) return MergeChannels(f.getChannel(1),f.getChannel(2),c,f.getChannel(7),f.getChannel(5), f.getChannel(6)) } function upmixFarina(clip a){ # Farina/Sursound approach Profile M=L+R, S=L-R, c=0.75, L' = (1-c/4)*M+(1+c/4)*S, C' = c*M, R' = (1-c/4)*M-(1+c/4)*S f = invertFilter(a, 0.500, 0.668) ff= mixaudio(f.getChannel(3),f.getChannel(4),0.500,0.500) l= mixaudio(ff,f.getchannel(1),0.8125,1.1875) r= mixaudio(ff,f.getchannel(2),0.8125,-1.1875) c = mixaudio(f.GetChannel(3),f.GetChannel(4),0.3750,0.3750) return MergeChannels(l, r, c, f.getChannel(7), f.getChannel(5), f.getChannel(6)) } function upmixSoundOnSound(clip a){ # SOS approach Profile with 20ms delay and some attenuation on surround f = invertFilter(a, 0.000, 0.668) c = mixaudio(a.GetChannel(1),a.GetChannel(2),0.5,0.5) return MergeChannels(f.getChannel(3), f.getChannel(4), c, f.getChannel(7), f.getChannel(5), f.getChannel(6)) } Code:
... function dpl2FFD(clip a){return dpl2FFD(a, 0)} function dpl2FFDLFE(clip a){return dpl2FFD(a, 0.7)} function dpl2FFD(clip a, LF2){return dpl2Enc(a, 0.7071, LF2, -0.866, -0.5, 0.5, 0.866)} function dpl2FFDA(clip a){return dpl2FFDA(a, 0)} function dpl2FFDA(clip a, LF2){return dpl2Enc(a, 0.7071, LF2, 0.866, -0.5, -0.5, 0.866)} function dpl2FFDLFEA(clip a){return dpl2FFDA(a, 0.7)} function dpl2Enc(clip a, CC2, LF2, Ls3, Rs1, Ls1, Rs3){ cc = MixAudio(GetChannel(a, 3),GetChannel(a, 4),CC2,LF2) Lt = MixAudio(GetChannel(a, 1),cc,1,1) Rt = MixAudio(GetChannel(a, 2),cc,1,1) Ls = GetChannel(a, 5) Rs = GetChannel(a, 6) Lss = MixAudio(Ls, RS, LS3, Rs1) Rss = MixAudio(Ls, RS, LS1, Rs3) return MergeChannels(MixAudio(Lt,Lss,1,1), MixAudio(Rt,Rss,1,1)) }
__________________
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. |
24th November 2005, 12:14 | #15 | Link |
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
WOW! Very fine idea!
Seems like I can modify avs2wav in order to support inline scripting: Code:
BePipe.exe NicDTSSource("DtsMusic.DTS").GetChannel(2,3,1,6,4,5) | naac -profile he -vbr 8 - AacMusic.m4a
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS |
24th November 2005, 14:13 | #16 | Link |
Life's clearer in 4K UHD
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,219
|
Thanks for encoding and e-mailing the 6Ch AAC sample as per my instructions. There appears to be no doubt that Nero "has" changed the AC3-to-AAC mapping, when using external tools
I wonder if I could trouble you guys further by generating one last test file for me please. This time using Nero7's version of Recode 2. As I'm curious to see if this new version of Recode2 is handling the channel mapping correctly. Could you please use this PAL MPEG-2+AC3 12sec Sample as your source. Many thanks
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
|
24th November 2005, 18:02 | #17 | Link | |
nobody's nobody
Join Date: Mar 2005
Location: The Sun, somewhere around
Posts: 553
|
Quote:
I am not sure if the client application(avs2wav or BePipe) can call the avisyinth methods directly(dll interface calls with parameters) but the stardard interface is through *.avs script file. In this case, you will have to generate the temporary avs file in the program. When you replace the avs2wav itself, there seems to be some benefits as well as possible restrictions: . can make itself a gui appcation with user parameter input . can display the job progress like fobar2k cli call . hard to cover all the current & future features with simple user parameters . possibility of losing the flexibility in favor of the convenience. Overall, I will have to be satisfied with a role just reintroducing it. The rest is yours anybody talented. |
|
24th November 2005, 18:19 | #18 | Link | |
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
Quote:
So i will stop futher BeSweet plugin development and swith to BePipe development. It will be OpenSource command-line application written in C# (yeah, I do AVS2WAV to C# portation right now)
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|