I am new to AviSynth+. I am concatenating 9 clips, trimming the first and last, fading in the first and fading out the last, and cross-dissolving between clips. This code works:
It's quite verbose and repetitive. I have around 20 other shows to do this for and I wonder if some pre-processor script can take some of these parameters and arguments and produce the above AviSynth+ script.Code:audio=ffaudiosource("F:\_DSC001.MOV") video=FFMS2("F:\_DSC001.MOV") start=AudioDub(audio, video) clip1=Trim(start, 3600, 30000) audio=ffaudiosource("F:\_DSC002.MOV") video=FFMS2("F:\_DSC002.MOV") clip2=AudioDub(audio, video) ... same for clips 3-8 ... audio=ffaudiosource("F:\_DSC009.MOV") video=FFMS2("F:\_DSC009.MOV") clip9=Trim(AudioDub(audio, video), 0, 22575) FadeIn(clip1, 100) Dissolve(last, clip2, 50) Dissolve(last, clip3, 50) Dissolve(last, clip4, 50) Dissolve(last, clip5, 50) Dissolve(last, clip6, 50) Dissolve(last, clip7, 50) Dissolve(last, clip8, 50) Dissolve(last, clip9, 50) FadeOut(last, 100)
Does such a pre-processor exist, or could the AviSynth+ script be optimized or improved?
+ Reply to Thread
Results 1 to 8 of 8
-
-
ffms2 can include the audio so there's no reason to use ffaudiosource and audiodub. So you can replace this:
Code:audio=ffaudiosource("F:\_DSC001.MOV") video=FFMS2("F:\_DSC001.MOV") start=AudioDub(audio, video) clip1=Trim(start, 3600, 30000)
Code:clip1=FFMS2("F:\_DSC001.MOV", atrack=-1).Trim(3600, 30000)
Code:clip1=FFMS2("F:\_DSC001.MOV", atrack=-1).Trim(3600, 30000) clip2=FFMS2("F:\_DSC002.MOV", atrack=-1) ... same for clips 3-8 ... clip9=FFMS2("F:\_DSC009.MOV", atrack=-1).Trim(0, 22575) FadeIn(clip1, 100) Dissolve(last, clip2, 50) Dissolve(last, clip3, 50) Dissolve(last, clip4, 50) Dissolve(last, clip5, 50) Dissolve(last, clip6, 50) Dissolve(last, clip7, 50) Dissolve(last, clip8, 50) Dissolve(last, clip9, 50) FadeOut(last, 100)
-
Thanks! That makes it significantly simpler already. If anyone else can find ways to shorten it, I'm very interested. Otherwise I'll post here a little Python script that produces such an AVS script from a directory listing.
-
You should also know that both your FadeIn and FadeOut lines add a frame. Maybe it's not important in this case
-
You could also create a function that opens and appends each clip with a crossfade:
Code:function AppendWithCF(clip v, string name, int first, int last, int crossfade) { Dissolve(v, FFMS2(name, atrack=-1).Trim(first, last), crossfade) }
Then your script would look something like:
Code:function AppendWithCF(clip v, string name, int first, int last, int crossfade) { Dissolve(v, FFMS2(name, atrack=-1).Trim(first, last), crossfade) } FFMS2("F:\_DSC001.MOV", atrack=-1).Trim(3600, 30000) AppendWithCF("F:\_DSC002.MOV", 0, 0, 50) AppendWithCF("F:\_DSC003.MOV", 0, 0, 50) AppendWithCF("F:\_DSC004.MOV", 0, 0, 50) AppendWithCF("F:\_DSC005.MOV", 0, 0, 50) AppendWithCF("F:\_DSC006.MOV", 0, 0, 50) AppendWithCF("F:\_DSC007.MOV", 0, 0, 50) AppendWithCF("F:\_DSC008.MOV", 0, 0, 50) AppendWithCF("F:\_DSC009.MOV"0, 22575, 50) FadeIn0(100) FadeOut0(100)
-
Yes, that's what I was looking for. Thanks for the hint which does not trim and keeps the code simple:
Code:clip.Trim(0, 0)
-
Yes and no. Pretty much all functions take a video as input and a produce a video as output. Whenever you call a function without specifying a video AviSynth assumes the name "last". And whenever you don't specify a name for the video returned by a function AviSynth assumes the name "last". So a call like
Code:AppendWithCF("F:\_DSC002.MOV", 0, 0, 50)
Code:last = AppendWithCF(last, "F:\_DSC002.MOV", 0, 0, 50)
Code:video = FFMS2("F:\_DSC001.MOV", atrack=-1).Trim(3600, 30000) AppendWithCF("F:\_DSC002.MOV", 0, 0, 50)
Similar Threads
-
How to put two video clips side by side with VirtualDub and AviSynth?
By qingfeng in forum EditingReplies: 10Last Post: 1st Jun 2023, 08:57 -
AviSynth editing multiple clips
By jseo13579 in forum EditingReplies: 12Last Post: 21st Sep 2019, 22:20 -
ffmpeg: how to concatenate files that have different resolutions?
By marcorocchini in forum Newbie / General discussionsReplies: 1Last Post: 25th Jun 2017, 08:03 -
DOS Loop and Concatenate
By ron spencer in forum ComputerReplies: 7Last Post: 23rd Apr 2016, 21:45 -
[Avisynth] How to concatenate multiple audio/video files?
By marcorocchini in forum Newbie / General discussionsReplies: 6Last Post: 12th Mar 2016, 14:07