Nodes/ComfyUI-VideoHelperSuite/Select Every Nth Latent πŸŽ₯πŸ…₯πŸ…—πŸ…’
ComfyUI Node Runs on cloud

Select Every Nth Latent πŸŽ₯πŸ…₯πŸ…—πŸ…’

Thin a latent batch by a fixed interval

By KosinkadinkΒ·Created 3 years agoΒ·Updated 3 months agoΒ· 1,727
Select Every Nth Latent πŸŽ₯πŸ…₯πŸ…—πŸ…’
  • latents
  • LATENT
  • count
β—„select_every_nth1β–Ί
β—„skip_first_latents0β–Ί

This is Select Every Nth Image's twin, working on latents instead of images. Same idea - keep one out of every N and discard the rest - but it operates on a LATENT batch, so it fits into workflows that stay in latent space the whole way through. VideoHelperSuite ships image and latent versions of most of its batch utilities precisely so you can pick your point in the pipeline, and staying latent is the memory-cheap option on long video. It's from Kosinkadink's pack.

Why work on latents at all? Because for long sequences, holding thousands of decoded frames in RAM is exactly the thing that breaks. If your Load Video node emitted latents (you gave it a VAE), you want the whole downstream chain - thinning, merging, splitting - to stay latent and never balloon back into full images until you actually render. This node is the "thin it down" step in that latent-native chain.

How it works

It steps through the latent batch and keeps the first of every select_every_nth interval, dropping the rest. A skip_first_latents offset applies before the interval, so - just like the image version - you can run two copies with different offsets to divide one batch into interleaved, non-overlapping groups.

The inputs and outputs that matter

  • latents - the latent batch to thin.
  • select_every_nth (default 1) - the interval. 1 is a no-op; 2 keeps every other latent.
  • skip_first_latents (default 0) - discard this many from the front before the interval runs, to offset which latents survive.

Outputs are LATENT (the thinned batch) and count (the number of latents in the input).

How to install it

ComfyUI Manager: search ComfyUI-VideoHelperSuite, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite

then restart. No model downloads.

Common issues & troubleshooting

No effect. Default select_every_nth is 1, which keeps all latents. Bump it up.

Should I thin images or latents? If your pipeline is latent-native (long video, VAE at the loader), thin here to keep memory down. If you're already working with images for something like ControlNet, use the image version instead - converting to latents just to thin and back is wasted work.

count is the input size, not the output. Same as the image variant: count reports what came in, by design. Compute the output length from the interval, or read it off a downstream node.

Watch the temporal frame packing on newer video models. Some latent video architectures pack multiple frames into each latent, so "every Nth latent" isn't always "every Nth frame" one-to-one. If your thinning ratio comes out different than expected, that's why - check how many frames your model folds into a latent before choosing the interval.

CategoryVideo Helper Suite πŸŽ₯πŸ…₯πŸ…—πŸ…’/latent

Inputs (3)

NameTypeDefaultDescription
latentsLATENTβ€”
select_every_nthINT11–9007199254740991β€”
skip_first_latentsINT00–9007199254740991β€”

Outputs (2)

NameTypeDescription
LATENTLATENTβ€”
countINTβ€”