Nodes/DJZ-Nodes/Batch Range Insert
ComfyUI Node

Batch Range Insert

Splice replacement frames into a sequence

By MushroomFleet·Created 2 years ago·Updated 5 months ago· 78
Batch Range Insert
  • target_sequence
  • insert_frames
  • IMAGE
start_frame0
end_frame1

BatchRangeInsert is the frame-editing cousin of the DJZ batch family: instead of extracting a range (BatchThief) or rotating the whole sequence (BatchOffset), it replaces a range of frames in one sequence with a different batch of frames. Think of it as the timeline-splice operation for image batches - cut out a section, drop in new footage, keep everything before and after.

Three inputs do the work. target_sequence is your main clip (a batch of images - needs batch size > 1). insert_frames is the batch that will take over the chosen span. Then start_frame and end_frame define the range to remove - and here's the off-by-one that catches everyone: the range is inclusive, so start_frame = 2, end_frame = 4 removes frames 2, 3, and 4. The insert_frames batch then lands at the start_frame position, everything before and after is preserved, and you get one combined IMAGE out.

Concrete version from the author's own docs: a 10-frame target, 3 insert frames, start_frame = 2, end_frame = 4 → frames 0–1 of the target, then your 3 new frames, then target frames 5–9. The arithmetic: final length = original − (end − start) − 1 + inserted. So if you insert more frames than you removed, the sequence gets longer; fewer, and it gets shorter. That's the power of the node - it's a cut-and-paste, not a rigid swap, so you can use it to lengthen a clip with a new shot or trim one with a shorter replacement.

Why you'd build this into a workflow rather than doing it in an editor: automation. If you're generating video in a loop - say you render alternate takes of the same shot and want to drop the new take into a fixed position in a master sequence - this node lets a whole batch-pipeline do the splice without you touching an NLE. It's also the natural companion to BatchThief (extract a section → modify it → insert it back with this node).

The warnings are the usual batch-node fare. It prints a warning if either input isn't a real multi-frame batch, and frame indices get clamped to valid ranges rather than erroring - so end_frame beyond the batch's length silently truncates instead of telling you. If your inserted frames don't match the target's dimensions and channel count, the output will be inconsistent; keep your batches same-size. And remember the inclusive range, because end_frame defaulting to 1 with start_frame at 0 means the default action is "replace exactly the first frame."

No models, no downloads, pure tensor slicing - this is one of the lightest nodes in the DJZ pack. Install: ComfyUI Manager → "DJZ-Nodes", or cd ComfyUI/custom_nodes && git clone https://github.com/MushroomFleet/DJZ-Nodes && pip install -r requirements.txt. It lives in the image/batch category next to its siblings, and it's the one I'd actually reach for first if I were building a cut-in-frame pipeline from scratch.

Categoryimage/batch

Inputs (4)

NameTypeDefaultDescription
target_sequenceIMAGE
insert_framesIMAGE
start_frameINT00–999
end_frameINT10–999

Outputs (1)

NameTypeDescription
IMAGEIMAGE