Sample Video Frame
Cut any video down to exactly N frames
- video
- video
Video models are picky about frame counts. Wan runs 81 frames out of the box, LTX generations traditionally sat around 121, and most training pipelines want a fixed length so every clip in the batch has the same shape. Your source footage, meanwhile, is 2 seconds here and 9 seconds there. Sample Video Frame is the node that reconciles the two: feed it any VIDEO and it hands back a VIDEO with exactly the frame count you asked for, one of four strategies deciding which frames survive.
It's a core node from the mid-2026 video-dataset work, still experimental, and it sits at the natural choke point of any video graph: after a loader, before an encoder. Load a clip, cut it to your model's native frame count, then encode to latents - whether you're assembling training data with the dataset nodes or prepping an image-to-video input.
How it works
The node reads the clip's frame count and frame rate, then clamps num_frames to the video's actual length - ask for 100 frames from a 50-frame clip and you get 50, no error, no padding. Then the strategy takes over:
- uniform (default) - picks frames evenly spaced across the whole clip. Ask for 1 and you get the middle frame.
- head / tail - first or last N. Both are fully lazy: ComfyUI trims the reference without decoding a single frame.
- random - N distinct frames at random, but kept in chronological order, so you never get a scrambled clip back.
There's a second lazy trick hiding in uniform and random: the node opens the container once and decodes only the frame indices it actually wants, not the whole file. On a long clip that's the difference between reading a few megabytes and reading everything.
Inputs and outputs
- video - anything that produces a VIDEO: Load Video, a folder loader, or another transform.
- num_frames - default 16, range 1–9999. Set it to your model's native count.
- strategy - uniform / head / tail / random, default uniform.
- seed - only consulted when strategy is
random. It's a no-op otherwise, which trips people up when they bump it and see nothing change.
Output is a single video, same frame rate as the input.
Gotchas
- It samples; it doesn't interpolate. Uniform pulls real frames and drops the rest, so motion gets strobier than the original at the same fps. If you want smooth slow-motion or invented in-between frames, that's Frame Interpolate's job - this node is for length normalization, not quality upsampling.
num_framesis a cap, not a promise. A short clip yields fewer frames, and a downstream node that assumed exactly N may complain.- The output order is always chronological.
randomrandomizes which frames are kept, never their order - handy for training diversity, useless for "shuffle the clip." - For arbitrary contiguous ranges - not just head/tail - look at the sibling temporal crop nodes in the same family; they're the general case of this.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| video | VIDEO | Input video. | |
| num_frames | INT | 161–9999 | Number of frames to sample. |
| strategy | COMBO | uniform | uniform: evenly spaced, head: first N, tail: last N, random: random sorted. |
| seed | INT | 00–18446744073709550000 | Random seed (only used with 'random' strategy). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| video | VIDEO | Sampled video. |