The “trick” to Avisynth, such as it is, is to think of your operations as creating individual clips. You could export any of these clips and have a working video output. So you do something like:
rawclip = AviSource(“MyInputClip.avi”)
and now rawclip is a clip containing the original input video. You could put “return rawclip” next, open it up in VirtualDub, and see your original, unchanged video. My next step is to build up a “mainclip” variable which will ultimately contain the end product of my editing. Let’s say I want to cut out certain segments. I call out the portions I want to keep:
mainclip = rawclip.Trim(0, 5000)
mainclip = mainclip ++ rawclip.Trim(6000, 8000)
mainclip = mainclip ++ rawclip.Trim(9000, 15000)
The ++ simply appends the two clips. Each time, I’m adding a segment of the original video (rawclip) to the end product (mainclip). Then I want to do something fancy to a particular segment:
mainclip = mainclip ++ rawclip.Trim(17000, 17100).Reverse
Now I’ve reversed a portion of the original clip and added that to my output. Maybe that was the end of my video, so I want to export the result.
return mainclip.ConvertToYV12
MeGUI requires YV12 video to encode in H264, so in case my original clip wasn’t in that colorspace, I convert it.
Now let’s say I create a commentary track in Audacity and want to add that to the video. I can export the audio as a WAV using VDub, import it into Audacity, and mix there, then export to a new WAV and import that into Avisynth. Or I can just export the commentary alone and do something like this:
soundclip = WavSource(“MyCommentary.wav”)
mainclip = MixAudio(mainclip, soundclip, 0.3)
right before the return statement. That mixes the two audio clips together in a 30:70 volume ratio - I can play with that number until I get something that sounds good. If my soundclip variable is the game and commentary audio already mixed, I can just replace the audio track entirely:
soundclip = WavSource(“FinalAudio.wav”)
mainclip = AudioDub(mainclip, soundclip)
So if you’re having trouble with your order of operations, you’re just not writing your script from top to bottom. Give that a try. I’m always open to help with Avisynth scripting problems or helping you figure out how to do more complex things, and the best part about Avisynth is that if I write a script for a nifty effect, I can just send you the text file and you can apply that effect yourself. It’s fairly simple once you understand how it all works.