Count Video Extend S2V
Never hand-count your Wan S2V extend nodes again
- count_plus_one
This node exists to fix one very specific, very annoying mistake: forgetting to update the batch count when you add, remove, or bypass a Wan S2V Extend node. The author calls it "quick and dirty" in the README, and honestly, that's a feature. It's a single integer counter with no inputs, no model files, and no Python dependencies. You wire it to the "Value" of your "Batch Sizes" node and it just handles the bookkeeping.
Why the +1?
Wan 2.2 S2V (Alibaba's speech-to-video model on the 2.2 base, Apache 2.0 and ungated) doesn't work like a normal video sampler. In a native S2V workflow you chain a sampler plus one or more Wan Sound Image to Video Extend nodes, and the model counts the sampler node plus every active extend node. So the batch size you pass in isn't the number of extend clips - it's number of extend nodes + 1. Forget the +1 and the run breaks or silently comes out wrong. Three extend nodes means a batch of 4, not 3.
That's the whole trick behind this pack. It counts the extend nodes currently in your workflow, adds one, and hands you the number. Bypass an extend node and it drops out of the count automatically, which is the exact case that used to wreck people's runs.
How it works
The node grabs the execution prompt via a hidden PROMPT input (plus EXTRA_PNGINFO as a fallback) and scans every node in it. It looks for class names that are WanSoundImageToVideoExtend or contain VideoExtend (excluding its own name), and counts them. Bypassed and muted nodes never make it into the execution prompt, so they're ignored for free - the README's "ignores bypassed nodes" claim is real, it's just ComfyUI doing the filtering upstream.
Its IS_CHANGED method returns a random value on every call, forcing the node to re-execute each run. That's deliberate - it's how the count stays fresh instead of being cached by ComfyUI.
Inputs and outputs
There are no inputs. None. Zero to configure. The single output is:
count_plus_one(INT) - the number of active S2V extend nodes plus one, with a floor of 1.
Plug that into the "Value" of a Batch Sizes node and you're done. It's also an output node, so as long as it's in the graph it'll execute and refresh.
Installing it
Search "Video Extend Counter" in ComfyUI Manager and hit install, or clone it by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/Urabewe/ComfyUI-CountS2VExtend
Then restart ComfyUI. No requirements.txt, no heavy dependencies - the whole thing is one Python file using only the stdlib. The pack title on comfy.icu is "ComfyUI Video Extend Counter."
One trap: the README's own clone command still contains a placeholder URL (git clone https://github.com/yourusername/...). Copy-pasting that fails. Use the repo above.
Gotchas worth knowing
- It spams the console. The node prints a debug line for every node in your prompt on every run. Harmless, but expect noise in your terminal if you run it long.
- It counts by name, not by connection. It scans the whole executed graph, so if your JSON holds a second S2V workflow you're not currently rendering, its extend nodes count too.
- Third-party S2V extend nodes may not match. The name matching is tuned for ComfyUI's native classes, so an extend node from another pack with a different class name can slip through.
- It re-executes constantly. The forced
IS_CHANGEDmeans it never caches, which is exactly what you want here, but it also means every run does a full scan. With a handful of nodes that cost is nothing.
For a pure utility, this is one of the rare ones that earns its keep - it removes a failure mode you'd otherwise hit repeatedly in long Wan S2V sessions. It's not glamorous, but it's genuinely useful.
Inputs (0)
No inputs
Outputs (1)
| Name | Type | Description |
|---|---|---|
| count_plus_one | INT | — |