Log in

View Full Version : VapourSynth equivalent for SelectRangeEvery


stax76
23rd June 2015, 16:36
I have some code to perform a compressibility check:

SelectRangeEvery(x, 14)

Is this the correct VapourSynth equivalent:

clip = core.std.SelectEvery(clip = clip, cycle = x, offsets = [0,1,2,3,4,5,6,7,8,9,10,11,12,13])

maybe the array/list can be expressed shorter? I'm clearly not a Python programmer. :)

Myrsloik
23rd June 2015, 19:20
I have some code to perform a compressibility check:

SelectRangeEvery(x, 14)

Is this the correct VapourSynth equivalent:

clip = core.std.SelectEvery(clip = clip, cycle = x, offsets = [0,1,2,3,4,5,6,7,8,9,10,11,12,13])

maybe the array/list can be expressed shorter? I'm clearly not a Python programmer. :)

If you just want one frame per cycle you can simply do clip[offset::cycle]

And any iterable is fine so you can write:
clip = core.std.SelectEvery(clip = clip, cycle = x, offsets = range(14))

stax76
23rd June 2015, 20:17
Yes, it is. You can use list(range(0, 14)) to conveniently generate a list for offsets in your example.

If you just want one frame per cycle you can simply do clip[offset::cycle]

And any iterable is fine so you can write:
clip = core.std.SelectEvery(clip = clip, cycle = x, offsets = range(14))

:thanks: