Vapoursynth SelectEvery

From wiki.selur.net
Revision as of 08:54, 15 November 2026 by Selur (talk | contribs) (New filter page (via create-page on MediaWiki MCP Server))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

SelectEvery splits the clip into repeating groups of frames and keeps only the frames at the listed positions of each group. It does not look at the picture; it simply follows a fixed pattern.

Filtering → Vapoursynth → Frame → Reduction

SelectEvery controls in Hybrid
SelectEvery controls in Hybrid

What it does

The clip is cut into groups of Cycle frames. From each group the frames at the positions given in Offsets are output, in the listed order. Typical uses are simple decimation (keep 4 of 5), fixed pulldown patterns, taking every n-th frame, or doubling and reordering frames: offsets may repeat ("0 0 1" outputs frame 0 twice) and need not be sorted.

Settings

Control Parameter Range / values Hybrid default Meaning
Cycle cycle 2 – 100 5 Size of one group in frames.
Offsets offsets positions 0 … Cycle − 1, separated by spaces empty Positions inside each group that are kept; repeats and any order are allowed.
Adjust FPS – on/off on On: the frame rate is lowered in the same ratio as the frame count, so the duration stays the same. Off: the original frame rate is kept, so the clip gets shorter and plays faster.

Example

Offsets 0 1 2 3 (the offsets field is empty by default, which writes nothing), otherwise default settings, on a 10-bit YUV 4:2:0 source (640x356, 25 fps):

# adjusting frame with SelectEvery
clip = core.std.SelectEvery(clip, cycle=5, offsets=[0, 1, 2, 3]) # new fps: 20

How Hybrid calls it

  • SelectEvery works on any format, also on interlaced material; nothing is converted and no value depends on the bit depth.
  • Cycle and Offsets are always written. With an empty Offsets field the filter is skipped.
  • Offsets that are not numbers or lie outside 0 … Cycle − 1 are left out, and a note about it goes to the log and into the script, so the script never breaks. If no valid offset is left, the filter is skipped.
  • Frame count: (number of offsets) / Cycle of the input frames. With Adjust FPS on, the frame rate changes by the same factor (29.97 fps, Cycle 5, four offsets → 23.976 fps); with Adjust FPS off the input rate is kept.
  • Each queued instance uses its own Cycle and Offsets for the frame rate.

Background

Core function

SelectEvery is a VapourSynth core function, so no plugin is needed. By default it also changes the frame rate and the frame durations; for "Adjust FPS off" Hybrid tells it not to. AviSynth has a function of the same name, a generalisation of SelectEven, SelectOdd and Pulldown.

To keep a stretch of consecutive frames out of every block (test encodes), see Vapoursynth SelectRangeEvery. For decimation based on picture content, see Vapoursynth TDecimate.

Sources