Nodes/ComfyUI-FrameUtilitys/Frame Replacer ✂️
ComfyUI Node

Frame Replacer ✂️

Cut-and-paste for individual frames of a video

By lum3on·Created about a year ago·Updated 2 months ago· 16
Frame Replacer ✂️
  • source_video
  • replacement_frames
  • modified_video
target_frame0
replace_count1
width512
height512
interpolationbilinear
methodkeep proportion
conditionalways
multiple_of0
blend_edgesfalse
blend_strength0.5
loop_replacementtrue
preserve_lengthtrue
memory_efficienttrue

FrameReplacer is the frame-accurate edit node. Where FrameExtender splices whole clips together, this one swaps out a specific run of frames inside a video: frame 40 through 55 becomes a new sequence you feed in, everything else stays untouched. It's what you reach for when a re-render left a glitched face for a few frames, you want to swap in a better take of one shot, or you need to overwrite a segment of a video with new content at an exact timestamp.

How it works

You give it source_video (the video to edit) and replacement_frames (what goes in), then point at the spot with target_frame (0-based index) and say how many frames to replace with replace_count. It slices the source around that window and drops the replacement in. Two flags control the edges of the behavior:

  • loop_replacement (default on) - if your replacement batch has fewer frames than replace_count, it tiles the batch to fill the gap, like a stamp. Turn it off and the replacement just ends early.
  • preserve_length (default on) - keeps the output the same length as the source. This matters more than it sounds: with it on, if the replacement overshoots the end of the video it gets capped; with it off, the length changes to match what you actually fed in. Keep it on unless you're deliberately re-timing the clip.

The boundary problem is the same one any video editor solves with a dissolve: a hard cut where your replacement meets the original frames can pop. blend_edges (default off) fixes that by crossfading the join, and blend_strength (0.0–1.0) controls how heavy the fade is. With a small blend_strength like 0.3–0.5 you get a soft landing instead of a visible seam.

The inputs that matter

  • target_frame and replace_count - the window. This is the whole job.
  • blend_edges / blend_strength - flip the first on when you see a seam at the boundaries.
  • preserve_length - leave on unless you specifically want the video to grow or shrink.

The rest (width, height, interpolation, method, condition, multiple_of) is the pack's shared advanced-resize system. Same caveat as the rest of this pack: defaults are 512×512 with condition: always, so set width/height to your real resolution and switch condition to if different unless you want an unexpected downscale. Output is modified_video, an IMAGE tensor you can feed to SaveImage/VideoCombine or keep processing.

Use cases

  • Fix glitches: rerun one bad section through a rediffusion or inpainting pass, then patch the clean frames back in.
  • Frame-accurate timing: swap a single frame to fix a flicker or a double-exposure.
  • Localized edits: replace just the segment you changed instead of re-rendering the whole video.

Installing

Manager: search "ComfyUI-FrameUtilitys". Or:

cd ComfyUI/custom_nodes
git clone https://github.com/lum3on/ComfyUI-FrameUtilitys

Restart. No models, no extra dependencies - the pack's requirements.txt is comments only, and everything runs on ComfyUI's bundled torch/numpy.

Troubleshooting

  • "Frame index out of bounds" - target_frame + replace_count exceeds the video length. Shorten replace_count or check your frame math; the readme's own advice is to verify replace_count doesn't overshoot available frames.
  • Replacement isn't showing up - check preserve_length; if it's on and your replacement overshoots, the tail gets cut to keep the length constant.
  • Visible seam at the join - enable blend_edges and nudge blend_strength up until the pop disappears.
Categoryimage/video

Inputs (15)

NameTypeDefaultDescription
source_videoIMAGESource video sequence to modify (IMAGE tensor format)
replacement_framesIMAGEFrames to use as replacements
target_frameINT00–10000Starting frame index for replacement (0-based)
replace_countINT11–1000Number of frames to replace
widthINT51264–8192Target width for frame resizing
heightINT51264–8192Target height for frame resizing
interpolationCOMBObilinearInterpolation method for resizing
methodCOMBOkeep proportionResizing method
conditionCOMBOalwaysWhen to apply resizing
multiple_ofINT00–512Round dimensions to multiple of this value (0 = disabled)
blend_edgesoptBOOLEANfalseSmooth blend at replacement boundaries
blend_strengthoptFLOAT0.50–1Strength of edge blending (0.0 = no blend, 1.0 = full blend)
loop_replacementoptBOOLEANtrueLoop replacement frames if fewer than replace_count
preserve_lengthoptBOOLEANtrueMaintain original video length
memory_efficientoptBOOLEANtrueProcess in chunks to save memory

Outputs (1)

NameTypeDescription
modified_videoIMAGE