|
|
| AEN007 |
| Posted: Jun 23 2011, 01:41 PM |
 |
|

Advanced Member
  
Group: Members
Posts: 90
Member No.: 24508
Joined: 10-November 08

|
I would like to downmix an avi file with 6 channel audio to stereo.
The aviSynth page here» http://avisynth.org/mediawiki/GetChannel gives a link to the doom page here» http://forum.doom9.org/showthread.php?p=12...880#post1243880 VirtualDub gives me the error message,
| QUOTE | | The script's return value was not a video clip |
when I try to use the following
| CODE | 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) } |
I'm not sure exactly how to use the above in an avs script. Any helpful replies/insights appreciated. Thank you. Regards, AEN Æ |
 |
| evropej |
| Posted: Jun 23 2011, 03:18 PM |
 |
|
Advanced Member
  
Group: Members
Posts: 514
Member No.: 26523
Joined: 28-November 09

|
try xmedia recode, a lot easier interface. I have never never tried down mixing audio myself. |
 |
| ale5000 |
| Posted: Jun 23 2011, 03:46 PM |
 |
|

Advanced Member
  
Group: Members
Posts: 1114
Member No.: 22180
Joined: 30-September 07

|
If the audio is AAC or AC3, the ACM codecs will do the work (if you specify the proper option in VirtualDub) and in this case you don't need avisynth.
-------------------- New VirtualDub forum VirtualDub AIO (All-in-One installer for VirtualDub and plugins) Codec Toolbox RS (A tool to read/change merit of codecs and many other things) Input plugins for VirtualDub / ACM codecs / VFW codecs |
 |
| Wilbert |
| Posted: Jul 1 2011, 07:11 PM |
 |
|
Advanced Member
  
Group: Members
Posts: 132
Member No.: 6270
Joined: 11-September 03

|
@AEN007, post your complete script. |
 |
| AEN007 |
| Posted: Jul 30 2011, 03:59 PM |
 |
|

Advanced Member
  
Group: Members
Posts: 90
Member No.: 24508
Joined: 10-November 08

|
30July2011
Greetings. Thanks for the replies.
| QUOTE (ale5000 @ Jun 23 2011, 03:46 PM) | | If the audio is AAC or AC3, the ACM codecs will do the work (if you specify the proper option in VirtualDub) and in this case you don't need avisynth. | This is true, but I use aviSynth to generate the output and cannot always use the (exported then customized) wav file from the avi file because of differing lengths and thus a/v sync problems ... Sometimes there is no a/v sync problem.
In any case I would like to know how to use the scripts from the doom thread. When I first encounted 6 channel avi files a few years ago, I found/used| CODE | # video = AviSource("c:\divx_wav.avi") # audio = WavSource(c:\divx_wav.avi) # stereo = GetChannel(audio, 1, 2) # return AudioDub(video, stereo) | I did not realize until this month that the above code did not completely downmix the 6 channel audio. I have tried| CODE | a = AviSource("c:\divx_wav.avi") 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) } | which gives the error message ...
Maybe some has some code that uses a doom script successfully? How does one use/replace "clip a" & "a" in the doom script? |
 |
| Wilbert |
| Posted: Aug 13 2011, 06:37 PM |
 |
|
Advanced Member
  
Group: Members
Posts: 132
Member No.: 6270
Joined: 11-September 03

|
Sorry for the late reply. Try
| CODE | 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) }
video = AviSource("c:\divx_wav.avi") Dmix6StereoLfe(video)
|
|
 |
| dloneranger |
| Posted: Aug 13 2011, 06:55 PM |
 |
|
Moderator
  
Group: Moderators
Posts: 2366
Member No.: 22158
Joined: 26-September 07

|
You use functions just like the normal commands (they are also functions)
Your problem is that avisynth returns the last clip used (unless you use the "return" command) The last function you used was Dmix6StereoLfe, and that returns an audio only clip (hence the error message, as avisynth returns the audio clip)
To fix it you have to merge the audio and the video together, like in your origional script
| CODE | 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) }
video = AviSource("c:\divx_wav.avi") audio=Dmix6StereoLfe(video) return AudioDub(video, stereo)
|
or, you could alter the function to return a video/audio clip eg
| CODE | 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) mixed=MixAudio(lrc, blr, 1.0, 0.2929) return AudioDub(a, mixed) }
video = AviSource("c:\divx_wav.avi") return Dmix6StereoLfe(video)
|
-------------------- MultiAdjust JoinWav WavNormalize FFMPeg Input Plugin v1827 UnSharpMask Windows7/8 Codec Chooser All FccHandlers Stuff inc. Installers for acm codecs AAC, AC3, LameMp3 |
 |
| AEN007 |
| Posted: Jan 16 2012, 09:00 PM |
 |
|

Advanced Member
  
Group: Members
Posts: 90
Member No.: 24508
Joined: 10-November 08

|
16January2012
I haven't had/made time (yet) nor had any occasion to need to try out any of the preceding ... sometime this year I will ...
Today I came across a 6 minute mp4 file with 6 channel / 5.1 aac audio. I could not get ViDub to spit out a "proper" wav file of the audio. I was able to get aviDemux to spit out a "proper" wav file ... |
 |
| ale5000 |
| Posted: Jan 16 2012, 10:26 PM |
 |
|

Advanced Member
  
Group: Members
Posts: 1114
Member No.: 22180
Joined: 30-September 07

|
Do you really need wav? You can go directly from 6 channel AAC audio in MP4 to stereo AC3 audio in AVI by only using VirtualDub + ACM codecs.
-------------------- New VirtualDub forum VirtualDub AIO (All-in-One installer for VirtualDub and plugins) Codec Toolbox RS (A tool to read/change merit of codecs and many other things) Input plugins for VirtualDub / ACM codecs / VFW codecs |
 |
| AEN007 |
| Posted: Jan 17 2012, 08:06 AM |
 |
|

Advanced Member
  
Group: Members
Posts: 90
Member No.: 24508
Joined: 10-November 08

|
17January2012
Well ... yeah ... as far as I can tell ...
I "customize/enhance" every video that I add to my collection. Sometimes (now) that means DSC the video & re-encode a customized audio track to certain/specific mp3 specs. Other times that means a full video multi-pass re-dub (now with MSUSD) & a customized audio track with certain/specific mp3 specs.
The starting point for the audio enhancement is to spit out the source audio track to wav. I then do various things in Audacity and/or WavePad. At a minimum I would apply the WP "automatic gain control" "effect" to set the track volume level at the max possible without distortion. If the movie is not a "talkie", I might do Audacity Bass Boost; then WP AGC; then Audacity Noise Reduction.
The 5.1 wav file that aviDemux spit out was actually a 6-track wav file! I've NEVER seen that before. I used Audacity to mix the 6-track wav file down to stereo ... |
 |
| AEN007 |
| Posted: Feb 1 2012, 08:48 AM |
 |
|

Advanced Member
  
Group: Members
Posts: 90
Member No.: 24508
Joined: 10-November 08

|
1February2012
Greetings.
Wilbert's Code seems to work. ViDub opens the avs script with no error & says the audio is stereo.
ViDub gives the following error message to dloneranger's Code#1»
| QUOTE | | I don't know what "stereo" means. |
dloneranger's Code#2 seems to work. ViDub opens the avs script with no error & says the audio is stereo. I had to tweak Code#2 to resize»
| CODE | | return Dmix6StereoLfe(video.BicubicResize(320,240,0,.75)) |
I might prefer to use aviDemux instead of avs if/when necessary ... (e.g., a/v sync problems with the ViDub wav dump or when ViDub won't dump) but at least now I seem to have some options. Thanx! |
 |
|