Nodes/WAS Node Suite v3/Video Frame Sample (Advanced)
ComfyUI Node Runs on cloud

Video Frame Sample (Advanced)

Keep the frames you actually want

By WASasquatch·Created 3 years ago·Updated 4 days ago· 1,844
Video Frame Sample (Advanced)
  • video
  • video
num_frames16
strategyuniform
nth1
seed0
start0
end-1

Video generation is expensive, and most of the time you don't need to process all 240 frames of a clip - you need a representative handful, or a particular section, or a thinned-down version to test on. Video Frame Sample is the WAS Node Suite node that cuts a VIDEO down to a smaller set of frames, and its name carries "(Advanced)" because the strategy list gives you real control over which frames survive.

What it does

Feed a VIDEO in, tell it how many frames you want, and pick a strategy. The num_frames input caps how many come out (16 by default, up to 16,384), and it's capped at what the video actually holds. Then the strategy dropdown decides how they're picked:

  • uniform - the default. Evenly spaced frames across the clip, the classic "16 frames that represent this whole video" for a sampling or preview pass.
  • head / center / tail - the first, middle or last few frames, and they come out consecutive (a run of adjacent frames, not spread out). Worth noting these decode nothing - the node can pick them straight from the clip without pulling every frame.
  • random - a seeded pick, so a re-run with the same seed keeps the same frames. Good for shuffling training samples reproducibly.
  • every_nth - every nth frame, for thinning a long clip down to its skeleton.

The nth input applies on top of every strategy: 1 uses every frame, 2 thins to every other one first, then the strategy picks from what's left. So head with nth 2 takes the opening on alternate frames. seed only matters for random; the other strategies ignore it.

Cutting to a range

The two optional inputs, start and end, let the strategy pick from a range instead of the whole clip. start is the first frame to consider (0-based), end the last, inclusive - and both take negatives counting from the end, so -30 starts thirty frames before the end. End defaults to -1, which is the final frame, i.e. the whole clip when start is 0. An end that lands before the start is simply ignored and the whole clip is used, so you can't crash it that way.

Output is a single video socket holding the kept frames at the source's frame rate - so downstream it still is a video, just a shorter one. That's the natural pairing for the pipeline: sample down to 16 frames, run them through whatever frame-by-frame or video processing you're testing, and only commit to the full clip once it works.

Why "Advanced"

The distinction from the plain Image Frame Sample in the same suite is that this operates on the VIDEO type - the wire that carries a whole clip with its timing, which modern ComfyUI video loaders and savers use. If your workflow is Wan-style video generation (load → sample → save), you'll spend a lot of time tuning that pipeline on a clip that doesn't need its full frame count every test. That's the use case. It also makes a tidy companion to Video Info, which will tell you the clip's real frame count up front so you know what num_frames is sensible.

Installing it

Part of WAS Node Suite v3 (WASasquatch's was-node-suite-comfyui, MIT). Search "WAS Node Suite v3" in ComfyUI Manager, or:

cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was-node-suite-comfyui.git

Restart ComfyUI after installing. Requires ComfyUI 0.14.0+ and Python 3.10+. Video IO in modern ComfyUI is built on its own bundled video stack (PyAV/FFmpeg), so no extra packages are needed for this node.

CategoryWAS Suite/Animation

Inputs (7)

NameTypeDefaultDescription
videoVIDEOThe video to sample.
num_framesINT161–16384How many frames to keep, eg 16. Capped at what the video holds, and every_nth stops here too.
strategyCOMBOuniformuniform = evenly spaced; head = first; center = middle; tail = last; random = a seeded pick; every_nth = every nth frame. head, center and tail are consecutive, and decode nothing.
nthINT11–16384Step between the frames the strategy may choose from. 1 uses every frame; 2 thins to every other one first, so `head` takes the opening of the clip on alternate frames. It applies to every strategy.
seedINT00–18446744073709550000Seed for random, so a re-run keeps the same frames. Ignored by the other strategies. Any whole number; `0` is as good a seed as any.
startoptINT0-16384–16384First frame to consider, counting from 0. Negative counts back from the end, so -30 starts thirty frames before it. The strategy picks from this range rather than from the whole clip.
endoptINT-1-16384–16384Last frame to consider, inclusive. -1 is the final frame, which is the whole clip together with a start of 0. An end before the start is ignored and the whole clip is used.

Outputs (1)

NameTypeDescription
videoVIDEOThe frames that were kept, as a video at the source's rate.