I want to overlay multiple images on my video at different times. I have user function defined as
function myFunction(clip c, int coordinateX, int from, int to) {
c = c.trim(0, from-1) + c.trim(from, to).Overlay(myImage, x=coordinateX, y=667, mask=myImageMask, opacity=1) + c.trim(to+1, 0)
return c
}
which essentially takes myImage
image and place it on specific part of the clip.
I call my function as
video = video.myFunction(320, 1, 187)
and I have bunch of those like this (I'm trying to make some sort of animation with multiple images)
video = video.myFunction(320, 1, 187)
video = video.myFunction(480, 1, 187)
video = video.myFunction(640, 1, 187)
video = video.myFunction(320, 187, 374)
video = video.myFunction(480, 187, 374)
video = video.myFunction(640, 187, 374)
video = video.myFunction(319, 374, 561)
and everything works fine if there is less than ~400 of those calls. If I exceed that limit, "Out of Memory" occurs (I'm using VirtualDub).
I suppose it's because AviSynth must process all the calls to figure out the output (although only ~3 of those 100s of calls are related to specific single frame). If I however remove video =
at the beginning of the line, I could have 10000 of those and there is no "Out of Memory" error but of course I don't have video out.
Is there a fix to this? Hundreds/thousands of image overlays at different times on the video clip?