Log in

View Full Version : How made a "For" function in avisynth ?


Dark-Cracker
15th June 2003, 09:46
hi,

i made some search but i have not found an answer perhaps now in avisyth v2.5.2 is it possible.

i search to made somethink like this :

i=0
end=500

for (i=0;i<end;i++)
{
full=full + avisource("test.avi").trim(i,i+1)
}

do u think is it possible to made this in avisynth ?

thank u for your help.
Bye.

bilu
15th June 2003, 10:19
There are no loops in Avisynth.

Tools available at the moment, if you can adapt what you want, are these:

http://www.avisynth.org/index.php?page=ConditionalFilter

If you read thread "3.0 news" from this post:

http://forum.doom9.org/showthread.php?s=&postid=327770#post327770

you'll also see what kind of design limitations affect Avisynth today regarding loops, it may give you a better perspective.



Best regards,
Bilu

waka
16th June 2003, 00:47
You can sometimes use recursive functions to create a loop. The following should do what you want.

function loop(clip full, clip test, int count)
{
full=full+test.trim(count,count+1)
count=count+1
return(count==500 ? full : loop(full,test,count))
}
test=avisource("test.avi")
full=avisource("full.avi")
loop(full,test,0)


This isn't a very good way to do loops however, anything complicated becomes very awkward or impossible. Depending on what you are doing, there are also limations to how large a loop you can make in this manner. For example, avisource("test.avi") had to be brought outside the loop. Otherwise it's equivalent to having 500 avisources in one script and that can cause a problem. Presumably there is a similiar limitation to the number of filters(splices, etc.) that can be performed inside the loop.

Edit:This thread (http://forum.doom9.org/showthread.php?s=&threadid=55424) explains the limitation issues.

Dark-Cracker
16th June 2003, 07:36
hum interesting thank u i will test it as soon as possible :)
Bye.

geoffwa
16th June 2003, 12:04
If you use more than 100 sources Avisynth also tends to run out of file handlers :(

Maybe we need to update the documentation to reflect this :confused:

Dark-Cracker
16th June 2003, 18:48
hum it seems the limitation of the "trim" is 128 above the loop crash :( damn i was very sad .

bye.

bilu
16th June 2003, 20:58
Just for curiousity, can you tell us what you intended to do?


Bilu

Dark-Cracker
16th June 2003, 21:24
in fact i want to force the "call" function to execute on each frames.
to do this i recreate a movie by pasting each frame and i use a call funtion on frame zero. it was a bit crap but i need it to made some tests :)

Bye.

sh0dan
16th June 2003, 21:30
The conditional filters should be of help here - especially FrameEvaluate()

bilu
16th June 2003, 22:25
Callcmd="Call(yourcmd,"
FrameEvaluate(Eval(Callcmd+string(last.framenumber)+")"))


This would work if there were any last.framenumber :rolleyes:

The only way you can get the framenumber is in a subtitle, which is not very useful... :confused:


Sh0dan? :D



Bilu