ComfyUI Tuple Counter
The node that answers 'how many things is that?'
- elements_count
ComfyUI Tuple Counter is one of those nodes you install, ignore for a month, then suddenly need. It does exactly one thing: take a ComfyUI tuple/list-formatted string and tell you how many elements are in it. That's the whole node - one input, one output, no config.
Where this earns its keep in practice: a lot of nodes in the videoclipgenerator pack hand you list-shaped outputs. VibeMusicEngine, for instance, emits frame_numbers, text_lines, and start_frame_numbers/end_frame_numbers as lists. When you need to know "how many shots did this audio get chopped into?" before looping them through a per-frame generator, this is the counter you reach for. It's the kind of tiny value-plumbing node the whole ecosystem runs on - the graph-as-program stuff covered in the KB's node-plumbing essay, where half of what you wire up exists just to answer questions about the other half.
How it works
The input_list input is a STRING socket marked forceInput, which means you don't type into it - you wire a string in. The node's tooltip spells out what it accepts: a single item like ('item',), multiple items like ('item1', 'item2', 'item3'), or nested tuples like (('item1',), ('item2',)). It returns elements_count as an INT, which is a plain len() under the hood. Invalid or empty input returns 0 rather than crashing, which is the right behavior for a plumbing node.
One thing worth knowing: it's declared with INPUT_IS_LIST, so it's built to sit downstream of nodes that emit actual list values, not just the string representation. The tooltip is unusually explicit about this being designed for "ComfyUI's native tuple format output," which tells you the author built it while fighting the same list-wrangling annoyances you are.
What matters
input_list(wired in, STRING) - the tuple/list string to count.elements_count(INT) - how many elements it found.
Install
Same as every node in this pack - it's part of lazniak's videoclipgenerator suite. ComfyUI Manager, search "videoclipgenerator", or:
cd ComfyUI/custom_nodes
git clone https://github.com/lazniak/videoclipgenerator
cd videoclipgenerator
pip install -r requirements.txt
Then restart ComfyUI. It's a pure-Python node with zero extra dependencies, so this one won't drag in any model downloads.
Honest take
Is this the node you'd write an article about on its own? No, and it knows it. It's a ~40-line utility that exists because the author's flagship music-engine node outputs lists and you need counts. It's the one node in the pack without the buy_me_a_coffee donation checkbox - the author didn't even bother begging for this one, which tells you how utility-grade it is. If you only install this pack for the video nodes, you'll barely touch it. If you're building list-heavy workflows, it'll quietly save you from counting by hand every time.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| input_list | STRING | Accepts ComfyUI tuple/list output format. Examples of valid inputs: - Single item: ('item',) - Multiple items: ('item1', 'item2', 'item3') - Nested tuples: (('item1',), ('item2',)) Note: This node is specifically designed to count elements in ComfyUI's native tuple format output. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| elements_count | INT | — |