Slicing and other syntactic suger

This page describes some syntactic sugar pretty similar to the one provided in Python.

In Python you can perform slicing on the clips.

VapourSynth.nim provides similar capabilities. One difference is that VapoutSynth.nim returns ptr VSMap instead of clip or clips.

As in Python, the first frame has number 0. The last frame is referenced as last or -1. So it is ok to write:

clip[0..last]

You can operate on last like:

clip[15..last-10]

The frames can be reversed by changing the order. Is it ok to do:

clip[last..0]

or:

clip[last-10..10]

You can skip frames for instance:

  • Keeping Odd frames:
clip[1..last, 2]
  • Keeping Even frames:
clip[0..last, 2]

Concatenating clips

It is feasible to perform:

clip[0..50] + clip[50..0]

Repeating clips

It is ok to do:

clip1 = clip * 40
clip2 = 40 * clip

They both work

TODO: We should use the same approach as VapourSynth: using Loop


Last modified January 1, 0001