Log in

View Full Version : AviSynth to VapourSynth code translation


stax76
24th June 2015, 20:16
is there a better, possibly shorter way to achieve SelectEven and SelectOdd?

Select Even

fpsnum = clip.fps_num
fpsden = clip.fps_den
clip = core.std.SelectEvery(clip = clip, cycle = 2, offsets = 0)
clip = core.std.AssumeFPS(clip = clip, fpsnum = fpsnum, fpsden = fpsden * 2)

Select Odd

fpsnum = clip.fps_num
fpsden = clip.fps_den
clip = core.std.SelectEvery(clip = clip, cycle = 2, offsets = 1)
clip = core.std.AssumeFPS(clip = clip, fpsnum = fpsnum, fpsden = fpsden * 2)

Are_
24th June 2015, 20:23
From the docs:

# Select even numbered frames
ret = clip[::2]
# Select odd numbered frames
ret = clip[1::2]

stax76
24th June 2015, 20:47
works :thanks:

jackoneill
24th June 2015, 21:32
Also, SelectEvery will adjust the frame rate and frame durations for you.

stax76
24th June 2015, 21:45
Yes, somehow I missed it and made it much more complicated than it is. :o