Get Latent Count π₯π ₯π π ’
Get Latent Count
- latents
- count
Get Latent Count reads how many latents are in a batch and outputs the number as an integer. That's the whole node. In a video workflow, where a latent batch is a stack of per-frame latents, this is how you turn "the number of frames currently in this wire" into an actual value the rest of your graph can use.
Small, unglamorous, and genuinely useful the moment you stop hardcoding frame counts.
Why you'd reach for it
You want your workflow to adapt to whatever it's fed instead of assuming a fixed length. Maybe you split, selected, or repeated some latents and now you need to know how many you actually have - to drive a loop, feed a Video Combine's timing math, verify two branches match, or just display the count. Rather than track it in your head across a chain of nodes, you measure it here and the number is always correct.
It's a natural partner to the split, merge, select, and duplicate latent nodes in the same suite: those change the count, this reads it back so you can confirm the result or drive the next step.
A concrete example: you split a batch, repeat one half, and merge it back, and now you genuinely aren't sure how many latents you're holding. Rather than trace the arithmetic through three nodes by hand, drop a Get Latent Count on the final wire and read it. It's also the cheapest way to assert an invariant - feed the count and your expected frame number into a comparison and you'll catch a length mismatch at the exact node where it appears, instead of ten steps later when a decode throws a shape error.
How it works
No settings, no options. It reads the length of the batch along the frame axis and emits it as an INT.
Inputs and outputs
- latents (LATENT) - the batch to count.
- count (INT, output) - how many latents are in it.
Wire count into anything that takes an integer.
Installing it
comfy.icu bundles VideoHelperSuite in the image already - no install needed.
Locally: ComfyUI Manager β search ComfyUI-VideoHelperSuite β install β restart. Or clone it:
cd ComfyUI/custom_nodes
git clone https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite
then restart ComfyUI. It's Kosinkadink's suite, near-ubiquitous in video setups.
Common issues
There's essentially nothing to misconfigure - it's a length read. The only conceptual snag is expecting a number you don't get: if the count surprises you, the cause is upstream. Something earlier changed how many latents are flowing (a split that ran out of frames, a select, a repeat), and this node is honestly reporting the current state. That's a feature - use it to find the surprise, not to second-guess the node.
If Get Latent Count isn't in your menu at all, that's the pack failing to import rather than anything specific to this node. VideoHelperSuite dropping out usually means a missing ffmpeg or a NumPy version clash; the ComfyUI startup log names it, and a Manager reinstall fixes it.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| latents | LATENT | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| count | INT | β |