Crop Video (Temporal Random)
Random Temporal Crop Is Your Free Data-Augmentation Trick
- video
- video
Same idea as Crop Video (Temporal), with one twist that turns a boring utility into a data-augmentation move: the start frame is picked at random.
You give it a video and a length, and it keeps a random contiguous window of that many frames - frames 3 through 18 one run, frames 41 through 56 the next. For dataset prep that's genuinely useful. Video trainers want lots of short, varied clips, and randomly cropping each source video means every dataset build can show the model a different slice of the same footage. It's the temporal cousin of random horizontal flip for images: cheap variety, no downside.
How it works
Like its deterministic sibling, this node is fully lazy. It hands back a trim reference instead of decoded frames, so the crop costs essentially nothing regardless of video length. The randomness comes from numpy's RandomState, seeded with your seed value - same seed, same clip, same window every time.
That reproducibility matters more than it sounds. You can build a training dataset once with seed 0, rebuild it with seed 42, and get a genuinely different sample set for a second run, all without touching anything else. If you need a run to be auditable, the seed gives you that too.
The inputs
Three inputs, and you'll set two of them:
- video - a VIDEO, typically lazy references from Load Video (from Folder).
- length (default 16) - frames to keep. Same 16-frame training-window default as the plain temporal crop.
- seed (default 0) - pick your slice. Change it to get a new random window.
When this one over the plain crop
If you want a specific part of a clip - the shot that starts at frame 40 - use VideoTemporalCrop. If you just need N frames and don't care where they come from, or you actively want variety, use this one. In practice the random version belongs in a training graph; the deterministic one is for when you know exactly what you want. Most people who reach for either will end up on this one.
Gotchas
Same silent clamping as its sibling, so the usual warning applies: ask for 32 frames from a 20-frame clip and you get 20. The random start is bounded so the window always fits - the node clamps length to the video first, then picks a start that works - but a shorter-than-requested result still means a mixed-length dataset if you weren't paying attention.
One genuinely obscure detail: the seed is capped at the 64-bit unsigned max internally and reduced modulo 2³²−1. Two seeds that differ by a multiple of that number produce the same random state. Vanishingly rare in practice, but if you're scripting over seeds, don't assume every value yields a unique slice.
It ships with ComfyUI core - nothing to install, no model files, no API key. Experimental, landed mid-2026 with ComfyUI's native dataset/trainer work. A small node with one good job.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| video | VIDEO | Input video. | |
| length | INT | 161–99999 | Number of frames to keep. |
| seed | INT | 00–18446744073709550000 | Random seed. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| video | VIDEO | Cropped video (lazy). |