Nodes/Fantastic H3 Prompt Builder/Fantastic H3 Video Edit Latent
ComfyUI Node

Fantastic H3 Video Edit Latent

Bring your own mask to an H3 edit

By Adudeguyman·Created 3 months ago·Updated 7 days ago· 303
Fantastic H3 Video Edit Latent
  • vae
  • images
  • mask
  • audio_vae
  • audio
  • latent
  • width
  • height
  • length
◄grow16►
◄keep_audiotrue►
◄megapixels0.98►

Masked video editing is the "change one thing, keep the take" trick: white in the mask gets regenerated, everything else is held to your source. The easy path in this pack is the Media Loader's Mask for editing panel, which handles the mask, the latent and the paste-back for you. This node is the other path - you already have a mask from somewhere else (a SAM node, a hand-painted one, an external tool) and you want H3 to sample against it.

Use it in place of the empty latent. That's the whole job. It replaces the "generate this whole clip from noise" latent with one that says: regenerate here, hold the rest.

How it works

It encodes your source frames through the H3 video VAE, builds a mask tensor on H3's latent grid, and returns both - the latent the sampler denoises against, with the mask telling it what's free to change and what's frozen to the source. Same idea as inpainting, applied to a clip: instead of a whole-frame img2img, the model is handed the original as context and only owns part of the picture.

grow widens the mask first, in source pixels, default 16. Keep it. Edges, contact shadows and reflections live just outside whatever you outlined, and if they don't get regenerated you get an object floating over its own leftover shadow.

The megapixels knob (default 0.98) picks the sampling size: it fits the clip into a square pixel budget while keeping its aspect ratio, and never enlarges it. So a 1080p source samples smaller than it was filmed, and a 480p source stays 480p. Set it to 0 to sample at the clip's own size and let your VRAM find out.

If you pass audio and audio_vae with keep_audio on, the soundtrack is encoded and held unchanged; the model regenerates picture only. Leave it off and the soundtrack is generated fresh, which for a targeted edit is usually the last thing you want - a clip that suddenly gets new room tone under untouched dialogue is jarring.

The inputs and outputs that matter

  • vae - the H3 video VAE. It raises if it isn't one.
  • images - the source clip's frames at 24 fps.
  • mask - white where the clip is regenerated. One mask per frame, or a single frame to apply across the whole clip. How many frames you get is H3's business, not yours: extra trailing frames are dropped to fit a legal clip length, and a mask with fewer frames than the clip is an error rather than a guess.
  • keep_audio, audio, audio_vae - as above. audio_vae is required the moment you actually pass audio.

Outputs: latent into the sampler, and width, height, length into the matching inputs on the RefMod Text Encode. Don't set those on the H3 node - the edit's geometry is decided by this latent, and the text side needs to agree with it.

One caveat worth knowing before you spend an hour debugging: Fantastic H3 Edit Composite reads its mask from the references bundle, which means it only knows about masks made in the Media Loader's panel. If you went the DIY route with this node, the paste-back is on you - hand the decoded frames to your own composite or stitch nodes.

Install

Same pack: Fantastic H3 Prompt Builder in ComfyUI Manager, or:

cd ComfyUI/custom_nodes
git clone https://github.com/Adudeguyman/ComfyUI-Fantastic-MiniMaxH3-PromptBuilder

Restart ComfyUI completely. You need ComfyUI 0.30.0+ and an H3 checkpoint, and - as with everything H3 - check the community licence's territory clause before you build a pipeline on it.

Where people get burned

"The mask is empty on every frame, so nothing would change." Correct result, unhelpful render. Check your mask is actually white where you think, and that it's the right way round: white is the regenerated region, not the protected one.

"The mask has N frames and the clip M." Give one mask per frame, or a single frame used for the whole clip. Interpolating is not something the node guesses at.

Keeping audio fails. Passing audio without audio_vae is an explicit error, and the tooltip is blunt about why: the audio VAE is what lets it hold the soundtrack at all. Wire it or turn keep_audio off.

The edit is mushy. Check the megapixels budget first - the clip is sampled within it, so a small budget plus a large grow leaves the model very little to work with. And read the console: it prints the frame count, the sampling size, the percentage of the video being regenerated and whether audio was held or generated.

Categoryconditioning/video_models

Inputs (8)

NameTypeDefaultDescription
vaeVAEThe H3 video VAE.
imagesIMAGEThe source clip's frames, at 24 fps.
maskMASKWhite where the clip is regenerated: whatever is being replaced, changed or removed. One mask per frame, or a single frame for the whole clip.
growINT160–256Widen the mask by this many source pixels, so edges and shadows are replaced too.
keep_audioBOOLEANtrueOn: the source audio is held unchanged. Off, or no audio connected: the soundtrack is generated fresh.
audio_vaeoptVAEThe H3 audio VAE, needed to keep the source audio.
audiooptAUDIOThe source clip's soundtrack.
megapixelsoptFLOAT0.980–16Sample at no more than this many megapixels, keeping the clip's shape; never enlarged. 0 samples at the clip's own size.

Outputs (4)

NameTypeDescription
latentLATENT—
widthINT—
heightINT—
lengthINT—