View Single Post
Old 3rd March 2008, 19:30   #6  |  Link
mikeytown2
Resize Abuser
 
mikeytown2's Avatar
 
Join Date: Apr 2005
Location: Seattle, WA
Posts: 623
@Gavino Thank you for the reverse order hint, that makes this a lot simpler to implement.

@Ebobtron The option to dissolve/blend the clips would be a good thing. [http://avisynth.org/mediawiki/Dissolve] In the long run, i would like to be able to support any transition. [http://avisynth.org/vcmohan/TransAll/docs/index.html] I think i would have to use an eval statement in order to do it. [http://avisynth.org/mediawiki/Intern...trol_functions]

In terms of the structure of the AddCutPoint function, i think it would look something like this
AddCutPoint(clip c, int start, int end, string transition, int duration)

where clip c is the a/v stream to cut up. int start is the starting frame to cut, int end would be the last or ending frame to cut. String transition would be the function name, and int duration is how long the transition will last. This function call would then store these 5 values into a 5 dim array. the only question i have is about storing a clip into an array; is this a bad idea? Int's and strings shouldn't be an issue but i'm not sure about the clip variable. The reason for storing the clip variable would be in the case of multiple a/v clips in a single script.


Anyway here is the simple script with transitions added
Code:
function CutFrames(clip c, int start, int end, string "transition", int "duration")
{
	duration = default(duration, 0)
	return Defined(transition) ? Eval(transition + "(c.trim(0, " + string(start) + "), c.trim(" + string(end) + ", c.Framecount()), " + string(duration) + ")") : c.trim(0, start) + c.trim(end, c.Framecount())
}


CutFrames(200, 800, "Dissolve", 60)

EDIT
I think i like this function better
Code:
function CutFrames(clip c, int start, int end, int "duration", string "transition")
{
	duration = default(duration, 0)
	transition = default(transition, "Dissolve")
	return Eval(transition + "(c.trim(0, " + string(start) + "), c.trim(" + string(end) + ", c.Framecount()), " + string(duration) + ")")
}


CutFrames(200, 800, 60)

Last edited by mikeytown2; 3rd March 2008 at 22:28.
mikeytown2 is offline   Reply With Quote