Nodes/ComfyUI-VideoBlender/Video Blend Stack (YC)
ComfyUI Node

Video Blend Stack (YC)

The node that finally puts one clip on top of another

By yichengup·Created 2 years ago·Updated 2 years ago· 37
Video Blend Stack (YC)
  • base_frames
  • blend_frames
  • layer_info
  • IMAGE
canvas_width1920
canvas_height1080
background_color#FFFFFF

This is the payoff node. VideoBlendLayer preps a clip, and VideoBlendStack is where the two clips actually become one: it takes a base video, an overlay video, and the LAYER_INFO bundle from the layer node, and composites them onto a canvas you size and color. If you want to stick a generated clip over a background video with a blend mode and some opacity, this is the node you reach for.

It's part of ComfyUI-VideoBlender, a small community pack that brings layer-based video compositing into the node graph - the sort of thing that normally means bouncing out to an NLE. It's one layer at a time here: base + one overlay. If you're stacking several clips (picture-in-picture, watermark, multiple overlays), the pack's VideoBlendStackAdvanced handles up to eight layers in one node; the plain Stack is the simple two-clip case.

How it works

The mechanism is straightforward and honest. Both frame sequences get resized to your canvas with bilinear interpolation, the canvas is filled with your background color, and then - this is the GPU part - each pair of frames is blended with the mode and opacity stored in LAYER_INFO. The blend math is pure torch (min/max/overlay formulas run as tensor ops), so it moves to CUDA when a GPU is available and clears the cache after. Output comes back as a standard uint8 IMAGE tensor, which is exactly what a VHS_VideoCombine node wants.

One detail worth knowing: the base clip gets resized too. Whatever canvas you set, both inputs are stretched to fit, so mismatched aspect ratios mean stretching, not cropping. For a 16:9 result from a square overlay, you're better off resizing/cropping the clips upstream (the example workflow uses LayerStyle's ImageScaleByAspectRatio for exactly this) than relying on the stack to frame things nicely.

The inputs that matter

  • base_frames - the bottom clip, an IMAGE frame sequence.
  • blend_frames - the clip that sits on top.
  • layer_info - the LAYER_INFO output from a VideoBlendLayer node. This carries the blend mode and opacity; without it the node has nothing to blend with.
  • canvas_width / canvas_height - default 1920x1080, and this is where everything gets resized to. It's also the resolution you'll want to match your exporter's settings.
  • background_color - a hex string like #FFFFFF. This is the color visible where neither clip covers the canvas - most relevant when your base is smaller than the canvas or has transparency.

The single output is IMAGE - the composited frame sequence, ready for VHS_VideoCombine or any downstream video node.

Installing it

Same as the rest of the pack. ComfyUI Manager: search "ComfyUI-VideoBlender", install, restart. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/yichengup/ComfyUI-VideoBlender.git
cd ComfyUI-VideoBlender
pip install -r requirements.txt

The requirements (opencv-python, numpy, torch, pillow, moviepy) are mostly already present in a working ComfyUI; moviepy is the notable extra. Remember the pack defines no load/save nodes - pair it with VideoHelperSuite (VHS_LoadVideo in, VHS_VideoCombine out), which is also what the pack's own example workflow uses.

Troubleshooting

The most common failure is a frame-count mismatch: if base_frames and blend_frames have different lengths, the per-frame loop breaks. Trim both clips to the same length upstream. If the canvas looks unexpectedly black, check your hex string - the parser quietly falls back to white (#FFFFFF) if it can't read the color, so a typo like #FFF won't error, it'll just look wrong. And if your overlay has hard, jagged edges after scaling, run the frames through VideoPreprocess first to feather them; that node exists precisely for this. Finally, GPU blending needs the CUDA torch your ComfyUI already ships with - if you're on CPU, blends still work, just slower.

CategoryVideoBlender

Inputs (6)

NameTypeDefaultDescription
base_framesIMAGE
blend_framesIMAGE
layer_infoLAYER_INFO
canvas_widthINT19201–7680
canvas_heightINT10801–4320
background_colorSTRING#FFFFFF

Outputs (1)

NameTypeDescription
IMAGEIMAGE