Smart Video Batcher (Warper)
Split your frame stack so the last batch doesn't blow up
- image
- image_batches
Long video generation on consumer GPUs is a memory game. You've got 800 frames from an input video, and the sampler can't chew more than 81 at a time without your VRAM filing for divorce. ComfyUI's batching story has always been "just make the batch smaller," but then you hit the wall every video pipeline hits: the final chunk isn't the size the model wants, and the whole queue dies. Smart Video Batcher (Warper) is the peace treaty. It takes one big image batch, cuts it into batch_length chunks, and pads only the last one so its length satisfies (n - 1) % 4 == 0 - the pattern video models like Wan and the SD-video family expect.
It lives in the "Warper Tools/Looping" category, one of the many small nodes in ComfyUI Warper Nodes, a niche pack by the workflow author AIWarper. This is the node you wire between your frame loader and your sampler (or an AnimateDiff-style setup) when you want to process a long clip in chunks without hand-building batch sizes.
How it works
Feed it an image batch (your frames) and a batch_length - the default 81 is a sensible starting point for many video models. The node carves off full batches of that size, then handles the remainder specially: it duplicates the last frame over and over until the leftover batch's length satisfies (n - 1) % 4 == 0. So if you feed 200 frames with batch_length 81, you get two full 81-frame batches and a padded final batch of 40 frames (39 frames + one duplicated last frame, since (39 - 1) % 4 != 0 but (39 + 1 - 1) % 4 == 0).
The image_batches output is a list of batches, not a single tensor - that's the pack's own IMAGE_BATCHES wire type. You won't plug that directly into a sampler; instead it feeds Get Batch By Index (Warper), which pulls one chunk out by number. Loop over the batches and each one is sampler-ready.
What to set
Only two inputs, so don't overthink it:
image- your full frame stack as a single IMAGE tensor.batch_length- target size per chunk. Match this to what your model/VRAM can actually sample; 81 is the default for a reason, but if you're on a 6–8 GB card, drop it.
Installing it
This is the pack install, and it's the same for every Warper node. Easiest path is ComfyUI Manager: search "ComfyUI-WarperNodes" and install, then restart. Or the manual way:
cd ComfyUI/custom_nodes
git clone https://github.com/AIWarper/ComfyUI-WarperNodes
# restart ComfyUI
There's no top-level requirements.txt for this pack - the batching nodes only need torch and numpy, which ComfyUI already ships. The only heavy download in the whole pack is the RAFT checkpoint for Flow Visualizer, and you don't touch it here.
Common issues
The two failure modes are both self-inflicted and both visible in the console. Feed it an empty batch and you get a warning and an empty list back - downstream nodes then fail, so guard your frame loader. Set batch_length to 0 or negative and it returns your original batch as a single item, which is probably not what you wanted but at least it's honest. Keep batch_length smaller than your total frame count, or this node is just doing extra work for no benefit. The padded duplicates of the last frame are visible in output if you're not re-encoding over them, so don't be surprised when the tail of your clip holds on the final frame a little longer.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| batch_length | INT | 811–8192 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image_batches | IMAGE_BATCHES | — |