Nodes/ComfyUI Silver Nodes/Silver H3 Segment Editor (regenerate a video segment)
ComfyUI Node

Silver H3 Segment Editor (regenerate a video segment)

Fix ten seconds of a video instead of re-shooting the whole thing

By SilverAndJade·Created about a year ago·Updated a day ago· 0
Silver H3 Segment Editor (regenerate a video segment)
  • model
  • clip
  • video_vae
  • audio_vae
  • saved_video
source_video
segment_prompt
timeline_start0.0
timeline_duration10.0
pre_roll_frames12
source_start0.0
source_end0.0
megapixels1.00
regenerate_audiofalse
audio_lock_strength0.35
seed0
steps20
sampler_nameres_multistep
schedulersimple
filename_prefixSilverH3SegmentEditor
formatmp4
frame_compression23.00
color_match_seamtrue

You've got a forty-second H3 clip and one seven-second stretch where the character's hand goes somewhere anatomically unlikely. Regenerating the whole thing means re-rolling the parts you liked. SilverH3SegmentEditor is the inpainting instinct applied to video: keep the take, surgically replace a segment of it, and make both seams land on pixels that already exist.

It's a MiniMax-H3 sampler underneath. The node takes a source video, lets you crop the section you care about, regenerates one segment inside it, and writes the whole cropped section back out at 24 fps - original frames where you didn't touch anything, generated frames where you did.

How it works

Continuity at both boundaries is the whole design:

  • The frame at the start of your segment becomes H3's frame-0 keyframe.
  • The frame at the end becomes the last-frame keyframe.
  • By default the source segment's audio is encoded as a spine and locked at every sampling step, so the regenerated video lip-syncs to the audio that was already there.

That last point is why the node is actually usable for dialogue. The regenerated mouth has to match the existing track instead of inventing its own take. The lock is done at the sampler level, which is deliberately the non-reference variant of audio conditioning - the reference-channel version is a ref2va-checkpoint feature and would fight the keyframes this node depends on. So this node wants an fl2v model, not a ref2va one.

Like the pack's other H3 nodes, the work is staged: encode once, sample once with the DiT hot, decode once.

The inputs

source_video is a dropdown of videos in ComfyUI's input folder - browse it, drag-drop a file onto the node, or use the Open video button in the preview panel to upload one. That panel is the part that makes this node pleasant: it plays the source and gives you SECTION and SEGMENT range handles to drag, plus a play button, instead of you doing arithmetic off timestamps.

segment_prompt describes the replacement content. timeline_start is seconds relative to the cropped section, not the original file, and timeline_duration (default 10) is the length you're replacing - snapped to H3's 5+17k frame grid at 24 fps.

In the optional group, source_start and source_end crop the source first: set them to keep only the minute you care about, then edit a ten-second segment inside it, and the output is exactly that cropped minute. source_end of 0 means "to the end". megapixels (default 1) sets the resolution of the whole output - the entire video is resized down to that total pixel count with both dimensions on 32-pixel boundaries, aspect ratio preserved as closely as the canvas allows, and if the source is already smaller it gets snapped rather than upscaled. Everything is normalised to 24 fps because that's what H3 generates and what its audio sync assumes.

regenerate_audio (OFF) is the important toggle: off keeps your original audio and locks the generation to it; on lets the model generate fresh audio for the segment, spliced over the original, with audio_lock_strength (0.35) controlling how hard the fresh audio is pulled toward the source so the new voice doesn't change room tone mid-scene. color_match_seam (ON) applies an affine colour match across both seams so the new segment doesn't glow. There's also pre_roll_frames (12), which the tooltip itself labels a TEST: it widens the regenerated region backward, snapped up to a multiple of 17 frames, so the camera motion has runway before the edit begins. It replaces source frames in place, and the keyframes keep the seams pixel-exact - but if the motion starts looking odd, set it to 0.

Output is one saved_video path: your cropped section, 24 fps, at the megapixel size, with the segment swapped.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/SilverAndJade/comfyui-silver-nodes

Restart ComfyUI. The pack's requirements.txt handles the older loader nodes (beautifulsoup4, moviepy, a pinned opencv-python==4.10.0.82); this node uses PyAV and the newer comfy_api.latest video types, which ComfyUI already provides, so a reasonably current ComfyUI is the real requirement. Then you need H3 weights - around 42.5GB, under the MiniMax H3 Community License whose applicable territory excludes the US, EU, UK and South Korea. Wired example: SilverH3SegmentEditor_Turbo_3x10s.json in the repo.

Where people get burned

The video has to be in the input folder. The preview panel says so outright when it can't load a file, and the dropdown won't list anything outside it. Use the Open button rather than copying paths around.

Everything gets resampled to 24 fps and the megapixel size. If your source was 30 fps or 4K, your output isn't - that's the design, not a bug, but it means this node is a finishing tool on footage you're happy to normalise, not a lossless wrapper.

Try regenerate_audio off first. Fresh audio is the fun option and the one most likely to sound like a different room. And if a regenerated segment shimmers, that's usually pre_roll_frames doing exactly what its tooltip warns about.

Categorysilver_nodes/sampling

Inputs (22)

NameTypeDefaultDescription
modelMODEL
clipCLIP
video_vaeVAE
audio_vaeVAE
source_videoCOMBOSOURCE video from the input folder (browse the dropdown, drag-and-drop, or use the Open button in the node's preview panel to upload). The section between source_start and source_end is used for the output; the segment is regenerated inside it and the whole cropped section is re-saved at 24 fps / the megapixel resolution.
segment_promptSTRINGPrompt describing the replacement segment content. The start and end frames are injected as first/last keyframes for continuity, and the source audio is locked in so the lipsync matches.
timeline_startFLOAT0.00–10000Start time of the segment to regenerate, in seconds RELATIVE to the cropped section (0 = the cropped section's start frame).
timeline_durationFLOAT10.01–100Duration of the segment to regenerate, in seconds. Snapped to H3's frame grid (5+17*k frames at 24 fps). Use the preview panel's SEGMENT handles to set it visually.
pre_roll_framesINT120–200TEST: number of extra lead-in frames generated BEFORE the edit so the camera motion has runway to establish before the actual edit starts. Snapped UP to a multiple of 17 (the H3 grid): 12 -> 17 frames (~0.7s at 24fps). The regenerated region widens backward by this amount and REPLACES the source in place (keyframes give a pixel-exact seam both sides). Experimental - remove if the motion is not improved.
source_startoptFLOAT0.00–7200Start (seconds) of the SECTION of the source video to use. Everything before this is ignored and NOT included in the output - e.g. crop a 10min video down to the 1min you want to work on, then edit a 10s segment inside it. Use the preview panel's SECTION handles to set it visually.
source_endoptFLOAT0.00–7200End (seconds) of the SECTION of the source video to use. 0 = until the end of the video. The FULL output is exactly this cropped section (normalised to 24 fps / megapixels).
megapixelsoptFLOAT1.000.01–4The WHOLE output resolution in megapixels: the entire video (source + regenerated segment) is resized DOWN to this total pixel count, keeping the source's aspect ratio as closely as the H3 canvas allows and both dimensions divisible by 32. If the source is already smaller it is snapped to the nearest 32-divisible size instead of upscaled.
regenerate_audiooptBOOLEANfalseOFF (default): keep the original audio - the source segment's audio is encoded and LOCKED into the generation at every sampling step, so the regenerated video lip-syncs to / recreates the existing audio, and the output keeps the original audio track untouched. ON: the model generates fresh audio for the segment; the generated audio is spliced into the output over the original, which is kept for the rest of the video. Use audio_lock_strength to pull the fresh audio toward the clip's voice/room tone.
audio_lock_strengthoptFLOAT0.350–1Only used when regenerate_audio is ON. How strongly the regenerated segment audio is pulled toward the SOURCE audio at every sampling step: 0.0 = fully fresh (the source is ignored, the model invents a new voice/room), 1.0 = fully re-locked (the generation reproduces the source audio). A middle value keeps the new audio consistent with the clip's environment/speech while still letting the model vary it.
seedoptINT00–18446744073709550000
stepsoptINT201–50
sampler_nameoptCOMBOres_multistep44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38
scheduleroptCOMBOsimple9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3
filename_prefixoptSTRINGSilverH3SegmentEditorOutput filename prefix.
formatoptCOMBOmp42 options: mp4, auto
frame_compressionoptFLOAT23.000–51H.264 CRF for the saved video. 0 = lossless, 23 = default good quality.
color_match_seamoptBOOLEANtrueApply affine color matching at the before/after seams so the regenerated segment blends visually with the original footage.

Outputs (1)

NameTypeDescription
saved_videoSTRINGPath of the saved output video: the whole source video re-sampled to 24 fps / the megapixel resolution, with the selected segment regenerated (start + end keyframes, audio kept or regenerated per the toggle).