Nodes/Dream Video Batches/๐Ÿ— Frame Set Merger
ComfyUI Node

๐Ÿ— Frame Set Merger

Splice two timelines together and decide who wins each frame

By alt-key-projectยทCreated 3 years agoยทUpdated 8 months agoยท 95
๐Ÿ— Frame Set Merger
  • a
  • b
  • frames
โ—„priorityโ–พโ–บ

Frame Set Merger [DVB] combines two frame sets into one, and the interesting part is what happens when both sets claim the same index. It doesn't error, it doesn't drop frames - it lets you decide which side wins. Give it a, b, and a priority of either use_a_when_possible or use_b_when_possible, and the result is a single set where every index is present and every conflict was resolved in favor of your chosen side. That makes it the node for replacing a stretch of one clip with frames from another, not just stitching clips end to end like Frame Set Append does.

How the merge works

The mechanics are simple: collect the union of both sets' indices, then for each index grab the frame from the priority set if it exists there, otherwise from the other set. It's a per-index "winner takes all" - no blending, no averaging, no interpolation. If a covers indices 0โ€“47 and b covers 24โ€“71, a merge with use_a_when_possible keeps a's 0โ€“47 where they exist and fills in b's 48โ€“71; flipped the other way, b's 24โ€“71 take over and a only survives on 0โ€“23.

That's the workflow, really: generate a second version of a middle section - a re-run with a different prompt, a different seed, a detail pass - offset it to line up with the span you want replaced, then merge with priority on the new version. The untouched head and tail of the original survive because they have no conflicting indices.

The rules it enforces

Two, and both are friendly about it. Frame rates must match - a mismatch raises an error naming both rates, so fix the upstream Create Frame Set values. And because merge is a union of indices, sets with gaps merge fine; the result is just a gappy set. That's fine for a merger, but downstream nodes have opinions: Blended Transition refuses to work on gappy sets, and Unwrap in FAIL mode refuses too. If you're merging as a final step, a Frame Set Reindex afterward gives you a clean contiguous timeline to hand off.

For aligned merges, Frame Set Index Offset is your friend: offset one set so its replacement span lands exactly on the indices you want to overwrite, then merge. Offset slides, merge replaces, reindex cleans up - it's a three-node combo that covers most "swap this segment" jobs.

The pack-wide exit rule

The output is a FRAME_SET, and standard ComfyUI nodes can't consume it. When the merged result is going to an encoder or save node, run it through Unwrap Frame Set [DVB] first to get a plain IMAGE batch and framerate. This is the same rule that applies to every node in the pack, and it's the most common thing that stumps beginners - wire the unwrap in from the start and the confusion never happens.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/alt-key-project/comfyui-dream-video-batches.git
cd comfyui-dream-video-batches
pip install -r requirements.txt

Restart ComfyUI, or search "Dream Video Batches" in ComfyUI Manager. No model downloads - a merge is pure index bookkeeping and tensor stacking.

Category๐ŸŽญ DVB/โœ‚ edit

Inputs (3)

NameTypeDefaultDescription
aFRAME_SETโ€”
bFRAME_SETโ€”
priorityCOMBO2 options: use_a_when_possible, use_b_when_possible

Outputs (1)

NameTypeDescription
framesFRAME_SETโ€”