PDA

View Full Version : Script help?


Attack
7th October 2009, 23:27
Hey, I wrote this script, but it seems more complex than it has to be.
Any way to simplify this?

loadplugin("C:\Users\Matthew\Desktop\fft3dfilter211\FFT3DFilter.dll")
V = DirectShowSource("1518950.avi")
V = Crop(V,0,60,-0,-60)
V = FFT3DFilter(V,sigma=3,bw=32,bh=32,ow=16,oh=16,plane=4)
V = FadeIn(V,50)
V = FadeOut2(V,75)
A = DirectShowSource("1518950.flv")
A = ResampleAudio(A,44100)
A = FadeOut(A,50)
skate = AudioDub(V,A)

intro = BlankClip(skate,75)
intro = Animate(intro,0,48,"Subtitle", "SkateCC.net",-1,-1,0,99999,"Segoe Script",0,"SkateCC.net",-1,-1,0,99999,"Segoe Script",48)
intro = Animate(intro,0,48,"Subtitle", "CotW 16",320,180,0,99999,"Segoe Script",0,"CotW 16",254,180,0,99999,"Segoe Script",48)
intro = FadeOut(intro,10)

clip1 = intro + skate

video = BlankClip(length=1000,fps=30)
track = DirectShowSource("Gym Class Heroes - Apollo 3-1-5.mp3")
track = ResampleAudio(track,44100)
clip = AudioDub(video,track)
clip = trim(clip,30,0)
clip = FadeIn(clip,25)
clip = FadeOut(clip,250)
track = KillVideo(clip)

clip2 = intro + skate
clip2 = AudioDub(clip2,track)

audio = MixAudio(clip1,clip2,0.65)

return AudioDub(clip1,audio)
Please ask if something isn't clear.

Gavino
8th October 2009, 00:44
Since only the audio track of clip2 is used, and this is the same as in clip, you could replace
track = KillVideo(clip)

clip2 = intro + skate
clip2 = AudioDub(clip2,track)

audio = MixAudio(clip1,clip2,0.65)
by
audio = MixAudio(clip1,clip,0.65)

Elsewhere, you could also use a filter-chain approach using implicit last instead of reassigning to variables multiple times, but that's more a matter of personal taste.

Attack
9th October 2009, 01:05
I've not bother with filter-chain yet. Eventually it'll come, but right now, I'm sticking to this approach.

I was just hoping their was an easier way to do some of the things. That's a reduction right there, but I was hoping more for something so I could delay one of the audio tracks by x frames.
It's the only real reason I create two same clips with different audio... so I can delay one of them for mixaudio.

Gavino
9th October 2009, 01:17
It's the only real reason I create two same clips with different audio... so I can delay one of them for mixaudio.
You can use DelayAudio (which doesn't require a video track) if that's all you want to do, but you also have a fade in and out for the second audio track, which does need video (since it's defined in terms of frames).

Attack
9th October 2009, 13:20
DelayAudio has to be defined in seconds which makes it hard since all I know is that it needs to be 75 frames.

It'd be easiest if I could just mux the other audio into it without such complications.

Gavino
9th October 2009, 18:22
Muxing the audio in is simple and requires nothing extra. The complications come from needing to do the other operations first (trim and fade) which work with frames and so require a temporary video track.

To add to my earlier comment, I now see the final AudioDub is redundant and can also be removed, so the entire second half reduces to:
video = BlankClip(length=1000,fps=30)
track = DirectShowSource("Gym Class Heroes - Apollo 3-1-5.mp3")
track = ResampleAudio(track,44100)
clip = AudioDub(video,track)
clip = trim(clip,30,0)
clip = FadeIn(clip,25)
clip = FadeOut(clip,250)

return MixAudio(clip1,clip,0.65)

Attack
9th October 2009, 22:26
That won't return audio only?

Gavino
9th October 2009, 23:35
No - in general, audio filters like MixAudio retain the video (if any) of their first clip argument. So here you end up with the video from clip1, which is what you want.

Attack
10th October 2009, 18:32
It reduces the script, that's a start.

Now I'm just trying to figure out how to do ramped slow mo.