Split Latents π₯π ₯π π ’
Split Latents
- latents
- LATENT_A
- A_count
- LATENT_B
- B_count
Split Latents cuts a batch of latents into two groups at an index you pick. The first split_index latents go out one socket, everything after goes out the other. If your latent stack is a video's worth of frames, this is how you carve it into "the first half" and "the rest" - or any two chunks you want to process differently.
It's the counterpart to Merge Batch: split apart, do something to one piece, glue back together. Together they let you treat a frame sequence as something you can slice and reassemble instead of an all-or-nothing blob.
Why you'd reach for it
The everyday use is processing part of a clip differently from the rest - run a different denoise on the opening frames, hold out a section, or peel off a leading frame to reuse as a reference. It's also the workhorse behind manual chunking: split off a fixed-size group, process it, split the next group off the remainder, and so on, when you want tighter control than an automatic batching system gives you.
How it works
split_index is the boundary. It's the index of the first latent that lands in group B, so with split_index = 8, latents 0β7 go to A (eight of them) and 8-onward go to B. The node also tells you how big each group came out, which matters for the edge case below.
The one behavior to burn into memory: if you give it fewer latents than split_index, it doesn't error - it puts everything into A and leaves B empty. So A_count won't always equal split_index; it equals split_index unless the input was shorter, in which case it equals the input length. That's why the count outputs exist.
Inputs and outputs
- latents (LATENT) - the batch to split.
- split_index (INT, default 0) - the boundary; the first index that goes to B.
Outputs:
- LATENT_A - the first group.
- A_count (INT) - how many landed in A (see the edge case above).
- LATENT_B - the remainder.
- B_count (INT) - how many landed in B.
The count outputs aren't decoration - wire them into your logic when you're chunking, because they're how you detect "ran out of frames."
Installing it
comfy.icu bundles VideoHelperSuite already, so there's nothing to do.
Locally: ComfyUI Manager β search ComfyUI-VideoHelperSuite β install β restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite
then restart ComfyUI. Kosinkadink's suite, standard equipment for video work.
Common issues
The classic surprise is an empty B. You set split_index = 16, fed in a 12-frame batch, and B came out with nothing - that's the documented behavior, not a bug: too-short input dumps everything into A. Check B_count; if it's 0 when you expected frames, your input was shorter than your split.
The default split_index is 0, which puts everything into B and nothing into A - also a valid but easy-to-miss state. Set the index to what you actually want.
If the node's absent from the menu, that's the pack failing to import (usually ffmpeg or a NumPy version clash). The ComfyUI startup log names the cause; reinstall through Manager.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| latents | LATENT | β | |
| split_index | INT | 0-9007199254740991β9007199254740991 | β |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| LATENT_A | LATENT | β |
| A_count | INT | β |
| LATENT_B | LATENT | β |
| B_count | INT | β |