Nodes/CS Hybrid 4K Image-to-Video/CS Batch Stride (keyframes)
ComfyUI Node

CS Batch Stride (keyframes)

Pick your video's keyframes in one stride

By lvqunx·Created about a month ago·Updated about a month ago· 0
CS Batch Stride (keyframes)
  • images
  • keyframe_images
stride8

Every video workflow has a moment where you need fewer frames, not more. CS Batch Stride is the 30-second version of that: give it an image batch (your generated video frames) and a number, and it hands back every Nth frame. That's the whole job, and in this pack it's the node that decides which frames get the expensive full-resolution treatment later.

It ships in CS Hybrid 4K Image-to-Video (lvqunx/comfyui-cs-hybrid), a brand-new pack whose whole trick is running the video diffusion model at 480P and only re-synthesizing a scheduled subset of regions at 4K. Within that pipeline, Batch Stride is the keyframe extractor: you don't want to img2img-refine all 121 frames of a clip - that's most of the cost you were trying to avoid. You pull out the keyframes, refine just those, and merge them back with the pack's CS Replace Keyframes node.

How it works

It's a plain Python slice: images[::stride]. Frame 0, then every stride-th frame after it, so with the default stride of 8 you get frames 0, 8, 16, 24… Whatever the underlying step is - VAE decode, latent slices, an upscale pass - the frames stay in order, which matters because order is what later lets the refined frames land back in the right slots.

The inputs that matter

There are exactly two, which is refreshing:

  • images - your frame batch (IMAGE). Wire in whatever the sampler or VAE decode produced.
  • stride - an INT from 1 to 256, default 8. How many frames apart the keyframes sit. A stride of 1 is a no-op that just copies the batch; 8 is the pack's default rhythm.

One output: keyframe_images, the decimated batch, ready for your img2img refiner.

The one thing you actually have to keep straight: stride must match the interval you feed to CS Replace Keyframes and the keyframe_every on CS Tile Scheduler. All three are describing the same cadence. If Batch Stride picks every 8th frame but Replace Keyframes is set to 12, your refined frames land on the wrong slots and you get a silent mess instead of an error - ComfyUI won't warn you.

Install

Install the whole pack once and you have all seven CS nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/lvqunx/comfyui-cs-hybrid
# restart ComfyUI

Or use ComfyUI Manager and search CS Hybrid 4K Image-to-Video. No extra pip dependencies - the pack leans on torch and torchvision that ship with ComfyUI, so there's nothing to babysit beyond a restart. (The RAFT weights for the flow node download themselves on first use, but you don't touch this node if you're only doing keyframes.)

Common issues

Honestly, not much goes wrong here. The failure modes are the mismatch trap above and the classic slice gotcha: if your stride is larger than the batch, you get frame 0 and nothing else - check the output count if your refiner suddenly has almost nothing to chew on. And a stride of 1 with a big batch is just a free copy that slows your graph down for nothing. Keep the numbers in sync and this node disappears into the workflow, which is exactly what a utility node should do.

CategoryCSHybrid

Inputs (2)

NameTypeDefaultDescription
imagesIMAGE
strideINT81–256

Outputs (1)

NameTypeDescription
keyframe_imagesIMAGE