Log in

View Full Version : Cloning, individually processing and merging clips?


Cary Knoop
3rd March 2017, 07:12
Is cloning, individually processing and then merging clips supported in Vapoursynth?


# make copies of a clip
for i in range(0, loop):
clips.append(clip[:])
...
# process all clips
for i in range(0, loop):
.. set unique parameters
.. process clips[i]
...
# merge all clips
for i in range(0, loop):
clip += clips[i]


Semantically there should not be a difference between the last loop and a single assignment right?


clip = clips[0] + clips[1] + clips[2] ......

jackoneill
3rd March 2017, 10:28
Making copies is not necessary. The original clip remains unchanged if you never assign anything new to it. You can pass it to however many filters you want.

clips = []
for i in range(0, loop):
clips.append(YourFilter(clip))


And yes, your third loop is almost the same as that single assignment. I say almost the same because the loop appends the filtered versions to the original clip, but the single assignment only splices the filtered versions together. You would need to use += to make it exactly the same as the loop.

If you have a lot of clips it's more efficient to call Splice directly. That way there is only one instance of it, instead of one for every addition operator.

clip = core.std.Splice(clips)
# Or if you want the original included, like in the loop:
#clip = core.std.Splice([clip, core.std.Splice(clips)])

Cary Knoop
3rd March 2017, 18:26
Making copies is not necessary. The original clip remains unchanged if you never assign anything new to it.

Great, thanks!


clip = core.std.Splice(clips)
Yes, this one works great.

Thanks for the help!