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

Select Latents πŸŽ₯πŸ…₯πŸ…—πŸ…’

Select Latents

By KosinkadinkΒ·Created 3 years agoΒ·Updated 3 months agoΒ· 1,727
Select Latents πŸŽ₯πŸ…₯πŸ…—πŸ…’
  • latent
  • LATENT
β—„indexes0β–Ί
β—„err_if_missingtrueβ–Ί
β—„err_if_emptytrueβ–Ί

Select Latents plucks specific frames out of a latent batch by index. You type in which ones you want - 0, 5, 12 - or a range like 0:16, and it hands you back exactly those latents, in the order you asked for. If you've ever wanted "just the first 8 frames," "every other frame," or "the last one," this is the surgical tool for it.

In a video workflow your latents are a stack, one slice per frame. Most nodes treat that stack as a monolith. Select Latents is the one that lets you address it like a Python list - because under the hood, that's basically what it's doing.

The index syntax (this is the whole node)

The indexes field is a comma-separated string, and it's genuinely expressive. Assuming 16 items (indices 0 through 15):

  • 0 β†’ returns item [0]
  • -1 β†’ returns the last item, [15] (negative indexing works)
  • 0, 1, 13 β†’ those three, in that order
  • 0:5, 13 β†’ a range plus a single: items 0,1,2,3,4, then 13 (ranges exclude the end index, Python-style)
  • 0:-1 β†’ everything except the last
  • 0:5:-1 β†’ [4, 3, 2, 1, 0] - a step of -1 reverses the range
  • 0:5:2 β†’ [0, 2, 4] - step of 2
  • ::-1 β†’ the entire batch, reversed

That reversal trick (::-1) is a genuinely handy one - it's how you flip a clip backwards without a dedicated node. And because output order follows the order you type, you can reorder frames freely, not just filter them.

Inputs and outputs

  • latent (LATENT) - the batch to select from.
  • indexes (STRING, default 0) - the selection expression above.
  • err_if_missing (BOOLEAN, default true) - if you reference an index that doesn't exist (say index 20 in a 16-frame batch), error out instead of silently skipping it. Leave it on while you're building so typos are loud.
  • err_if_empty (BOOLEAN, default true) - error if the selection ends up empty rather than passing nothing downstream.

Output is a single LATENT batch containing exactly your selection.

Installing it

comfy.icu ships VideoHelperSuite in the image already - nothing to install.

Locally, use ComfyUI Manager (search ComfyUI-VideoHelperSuite, install, restart) or clone it:

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

then restart. It's Kosinkadink's pack, the standard kit for anyone doing AnimateDiff, Wan, or LTX work in ComfyUI.

Common issues

The two error toggles are your friends, so know what they do. With err_if_missing on (the default), an out-of-range index throws instead of quietly dropping - which is what you want, because a silently-shortened batch downstream is a nightmare to debug. If you're intentionally over-selecting (grabbing "up to 16" from a variable-length batch) and want the extras to just not appear, turn it off deliberately.

Remember ranges exclude their end: 0:8 gives you eight frames (0–7), not nine. Off-by-one here is the single most common mistake, especially when you're trying to line up a selection with a context window.

If the node's missing entirely, that's the pack failing to import - check the ComfyUI startup log for the real cause (usually ffmpeg or a NumPy version clash) and reinstall through Manager.

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

Inputs (4)

NameTypeDefaultDescription
latentLATENTβ€”
indexesSTRING0β€”
err_if_missingBOOLEANtrueβ€”
err_if_emptyBOOLEANtrueβ€”

Outputs (1)

NameTypeDescription
LATENTLATENTβ€”