select_every
select_every(
input: Clip,
#{
cycle: Int,
offsets: Int | Array<Int>,
}
)
Builds a new clip by keeping selected frame offsets from every fixed-size cycle of one input clip. Offsets are zero-indexed within each cycle, preserve the written order, and may repeat; repeated offsets duplicate the corresponding source frame in the output.
The input must be one fixed-format planar Gray, YUV, or planar RGB clip with a
finite frame count and a positive constant frame rate. cycle must be greater
than or equal to 2. offsets must be one integer or a non-empty integer array
where every entry is greater than or equal to 0 and less than cycle. The
output frame rate is scaled by offsets.len() / cycle; scalar offsets counts
as one kept frame per cycle. In a partial final cycle, offsets beyond the input
frame count are ignored.
Examples
# Return even numbered frames, starting with 0.
output = source("input.mkv").std.select_every(#{ cycle: 2, offsets: 0 })
# Return odd numbered frames, starting with 1.
output = source("input.mkv").std.select_every(#{ cycle: 2, offsets: 1 })
# Fixed pattern 1-in-5 decimation, removing the first frame in every cycle.
output = source("input.mkv").std.select_every(#{ cycle: 5, offsets: [1, 2, 3, 4] })
# Duplicate every fourth frame.
output = source("input.mkv").std.select_every(#{ cycle: 4, offsets: [0, 1, 2, 3, 3] })
Input
One fixed-format planar Gray, YUV, or planar RGB clip with a finite frame count and a positive constant frame rate.
Output
A clip with the same format and resolution, containing the selected source
frames in cycle/offset order and using a frame rate scaled by
offsets.len() / cycle.
Options
cycle(Int) – Number of source frames in each selection cycle; must be at least2.offsets(Int | Array<Int>) – Zero-indexed frame offsets to keep from each cycle; duplicate entries duplicate frames.