Nodes/ComfyUI-AusBoss/Merge Batches πŸ†Ž
ComfyUI Node

Merge Batches πŸ†Ž

Join two clips into one, without the silent resize surprise

By ausbossΒ·Created about a month agoΒ·Updated 3 days agoΒ· 2
Merge Batches πŸ†Ž
  • a
  • b
  • images
β—„on_mismatchresize to aβ–Ί

Merge Batches πŸ†Ž takes two IMAGE batches and joins them into one, a's frames first and b appended after. That's the whole thing, and the reason it exists is that "just concatenate these tensors" is the one batch operation every video and sweep workflow eventually needs: reassemble a batch you split apart upstream, append a comparison strip to a run, or stack two clips before a single encode pass.

The honest framing: ComfyUI's own BatchImage/image-batch concat nodes exist, and torch.cat is what they all do under the hood. What this node adds is the part that usually bites you - what happens when the two batches aren't the same resolution. A naive concat fails with a shape error deep in a traceback. This one gives you a choice up front. on_mismatch has three settings: resize to a (the default - b's frames are bilinear-resized to a's dimensions), resize to b (the reverse), or error (refuse, and name both sizes so you know exactly what doesn't match). Channel counts are a hard boundary either way: it will not join a 3-channel batch to a 4-channel one, because silently inventing or dropping an alpha channel is the kind of thing you'd never notice until the output looked wrong.

How it works

Two inputs, a and b (both IMAGE, BHWC batches) and the on_mismatch dropdown. The result is one images output: a's frames, then b's. When sizes differ and a resize policy is picked, the resize is a plain bilinear torch.nn.functional.interpolate - fast, but it's a geometric squeeze, not a smart refit. b is moved onto a's device and dtype before the join, so a CPU/GPU mismatch doesn't blow up the concat.

Install

ComfyUI Manager is the easy route: search for ComfyUI-AusBoss under Custom Nodes and hit Install, then restart. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/ausboss/ComfyUI-AusBoss.git

Restart ComfyUI and Merge Batches πŸ†Ž sits under πŸ†Ž AusBoss/Utility. No extra Python dependencies. Minimum ComfyUI 0.27.1, and hard-refresh with Ctrl+Shift+R after frontend updates.

Common issues

The trap is the default. resize to a is convenient, but if a and b have different aspect ratios, bilinear-squeezing b into a's frame distorts it - a landscape clip jammed into portrait frames gets squashed, and you might not notice until the output plays. If the clips should be the same size, keep them that way upstream; if they genuinely differ and distortion is unacceptable, either resize them yourself first or set on_mismatch to error so a mismatch stops the run loudly instead of quietly mangling frames. And remember it's a join along the frame axis, not a side-by-side - if you want a two-up comparison strip, tile the frames yourself before merging.

CategoryπŸ†Ž AusBoss/Utility

Inputs (3)

NameTypeDefaultDescription
aIMAGEThe first batch; its frames come first in the result.
bIMAGEThe second batch, appended after a's frames.
on_mismatchCOMBOresize to aWhen the sizes differ: resize b's frames to a's size, resize a's to b's, or stop with an error.

Outputs (1)

NameTypeDescription
imagesIMAGEOne batch: a's frames followed by b's.