Animated Composite Masked (Batch)
Ken Burns Your Batch Without OOMing
- destination
- source
- mask
- transform_data
- IMAGE
Animating a batch of images over a background is one of those tasks that sounds trivial and then OOMs your machine the first time you try it. Paste a 100-frame foreground onto a background, naively, and you just materialized a giant tensor in memory. AnotherAnimatedCompositeMasked sidesteps that by compositing frame by frame - and on top of that it accepts transform data so each frame can be translated and scaled as it lands. That's the whole "Ken Burns over a moving subject" trick in a single node.
It's from AnotherUtils (marcoc2/ComfyUI-AnotherUtils), and it's the workhorse of the pack's animation story: this node consumes the TRANSFORM_DATA produced by AnotherTransformKeyframes or AnotherTransformOrchestrator and turns it into actual moving video frames.
How it works
Rather than building one huge output tensor and pasting into it, the node loops over frames and composites each one individually, so memory stays flat no matter how long your batch is - the pack advertises 100+ frames without touching your CPU RAM in a meaningful way. For each output frame it takes the destination frame, scales the source frame by the current scale (bilinear, with a hard cap at 16384px to prevent OOM), positions it using the current x/y, and pastes through the mask (or a solid mask if none is given). It even pads a short transform_data list by repeating the last frame, so a mismatched keyframe count doesn't crash the run.
anchor_mode decides what your x/y coordinates mean: top-left pins the corner, center treats the coordinates as the center of the pasted layer. Center is the sane default for the Ken Burns look.
The inputs
destination- the background batch. Can be a single frame (it loops over it) or a full-length background.source- the foreground batch you're animating. Longer or shorter than the destination is fine; it cycles.mask(optional) - the foreground's alpha or a separate matte. Needed when your source has a background you want to cut out.transform_data(optional) - theTRANSFORM_DATAlist of{x, y, scale}per frame, straight from the pack's keyframe nodes. Omit it and everything just pastes at position 0, scale 1.anchor_mode-top-leftorcenter.
What comes out
A single IMAGE batch: the full composited animation, same length as the longer of destination/source. Wire it to a video encoder and you have your clip.
Installing it
Standard AnotherUtils install:
cd ComfyUI/custom_nodes
git clone https://github.com/marcoc2/ComfyUI-AnotherUtils.git
Restart ComfyUI, or search "AnotherUtils" in ComfyUI Manager. No models.
Where people get burned
The classic mistake is a mask that doesn't match the source - if your mask is a single-frame while the source is 100 frames, or vice versa, you get flicker as it cycles. Keep mask and source the same length. Second, remember that transform_data coordinates are in destination pixel space: x/y come from your keyframe math, and if you scaled the source up, the coordinate math gets confusing fast. And the frame-by-frame approach means no GPU parallelism - a 512-frame composite runs as 512 sequential pastes, so don't expect instant results. For short clips it's plenty, and it won't eat your machine, which is the whole point.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| destination | IMAGE | — | |
| source | IMAGE | — | |
| anchor_mode | COMBO | center | 2 options: top-left, center |
| maskopt | MASK | — | |
| transform_dataopt | TRANSFORM_DATA | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |