Merge Latents π₯π ₯π π ’
Join two latent batches, rescaling mismatches
- latents_A
- latents_B
- LATENT
- count
Merge Latents is the latent-space version of Merge Images: it concatenates two LATENT batches, group A followed by group B, into one. Use it when your whole video pipeline stays in latent space - which for long sequences is the memory-smart way to work - and you need to reassemble segments you'd split apart. It's from Kosinkadink's VideoHelperSuite, and like the image version it can reconcile two batches at different resolutions rather than just failing when they don't line up.
The reason a latent version exists at all is memory. Decoding thousands of frames to images so you can merge them, then re-encoding, is exactly the round-trip that blows up RAM on long video. If your latents never left latent space, keep them there - split, process, and merge as latents, and only decode at the very end.
How it works
It joins A then B. When the two batches share a resolution, it's a plain concatenation. When they differ, merge_strategy picks the target size and the node rescales the odd one out to match before joining - the same reconciliation logic as Merge Images, applied to latents.
The inputs and outputs that matter
latents_Aandlatents_B- the two latent batches; A comes first in the output.merge_strategy- which resolution to standardize on: match A, match B, match smaller, or match larger (by area).scale_method- the resampling filter if scaling is required: nearest-exact, bilinear, area, bicubic, or bislerp.crop- disabled to stretch to the target aspect ratio, center to crop and preserve it.
Outputs are LATENT (the combined batch) and count (its length).
How to install it
ComfyUI Manager: search ComfyUI-VideoHelperSuite, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite
then restart. No model downloads.
Common issues & troubleshooting
Should I merge latents or images? Stay latent if your pipeline is latent-native - it's cheaper and avoids a decode/encode round-trip. Only merge as images if you're already holding images for another reason.
The two latent groups have different resolutions. That's what merge_strategy is for - pick which size wins. Note that rescaling latents isn't as clean as rescaling images, so prefer to generate both segments at the same resolution when you can; treat the rescale as a rescue, not a plan.
Order came out reversed. Output is A then B. Put the earlier segment in latents_A.
The join is visible in the final video. Merging happens at the batch level - it doesn't blend across the boundary. If your two segments were sampled independently, expect a hard cut where they meet, the same seam you'd get from a Meta Batch Manager. Overlapping the segments and blending in post is the only real cure; the node's job is concatenation, not crossfading.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| latents_A | LATENT | β | |
| latents_B | LATENT | β | |
| merge_strategy | COMBO | 4 options: match A, match B, match smaller, match larger | |
| scale_method | COMBO | 5 options: nearest-exact, bilinear, area, bicubic, bislerp | |
| crop | COMBO | 2 options: disabled, center |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | β |
| count | INT | β |