Skip to content
freakyjolly✳THE WORLD OF AI. EXPLAINED.
Search
← Latest stories

Best MiniMax H3 Video Section Editor in ComfyUI: Re-Generate Part of a Video with Frame Infill (Free JSON)

MiniMax H3 is great at generating a fresh clip, but sooner or later you get a render where 90% of the shot is perfect and one second in the middle is wrong. A hand goes weird, the character does the wrong move, or a few frames flicker. Re-rolling the whole clip throws away everything that already worked. What I wanted was a way to pick a frame range, tell H3 what should happen there, and splice only that range back into the original video with the original audio. This post walks through the exact ComfyUI graph I built for that: a MiniMax H3 video section editor with an optional painted mask for local edits. The workflow JSON is attached for download.

TL;DR

  • The stock H3 modes (t2va, fl2va, ref2va) can’t regenerate the middle of an existing video. The community node MiniMaxH3FrameInfill (red-polo/ComfyUI-MiniMaxH3FrameInfill) adds that by using the footage around the gap as anchors.
  • My graph wraps that node with PrimitiveInt START/END frames, ComfyMathExpression and four ImageFromBatch slices, so only the selected frames are swapped into the original video and the source audio is kept.
  • Two outputs: FULL FRAME EDIT (the whole frame in the range is replaced) and MASKED EDIT (only the area you paint in a LoadImage mask is replaced, via ImageCompositeMasked).
  • Settings: fl2va pruned int8 checkpoint, chunk_anchors mode, 640×640, euler + simple, 20 steps, seed 42 fixed, output at 24 fps.
  • Rules: input must be 24 fps, frame numbers are inclusive (seconds x 24), width and height must be multiples of 32, keep a few seconds of footage on both sides of the gap.

Why H3 Needs a Section Editor

The public MiniMax H3 modes cover text-to-video, first/last-frame video (fl2va) and reference-to-video (ref2va). None of them take an existing clip and regenerate a span in the middle of it. First/last-frame conditioning sounds close, but it only passes two still images at the boundaries. Two stills can’t tell the model how fast something was moving or which way it was swinging, so the bridged motion often doesn’t match what comes before and after.

The ComfyUI-MiniMaxH3FrameInfill custom node by red-polo solves this differently. You give it the full window of frames and a range [gap_start, gap_end], and it injects the footage on both sides of the gap as anchors so H3 regenerates the gap to connect with the surrounding motion. The author lists three uses: repairing broken spans such as black frames, joining or looping clips, and replacing the action in one part of a shot. I use it for the third one, and that’s what this graph is built around.

One thing to know up front, straight from the node’s README: the node is experimental and works by patching PackedLayout.__init__ in ComfyUI’s H3 model code. Stock H3 workflows fall back to the original code, but the author recommends pinning your ComfyUI version. I’d also save a copy of your current workflows before installing it.

What You Need (Node and Models)

Install the custom node and restart ComfyUI:

cd ComfyUI/custom_nodes
git clone https://github.com/red-polo/ComfyUI-MiniMaxH3FrameInfill

The README targets ComfyUI 0.30.x with native H3 support. Everything else in my graph is a core ComfyUI node. These are the model files my workflow loads, all from the Comfy-Org/MiniMax-H3 repository:

Loader node File Folder
UNETLoader minimax_h3_fl2va_pruned_int8_convrot.safetensors models/diffusion_models
CLIPLoader (type minimax) qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors models/text_encoders
VAELoader minimax_h3_video_vae_fp16.safetensors models/vae

The base Frame Infill node needs the fl2va checkpoint, not ref2va. The same repo also has bf16, fp8_scaled and w6a8 variants of the fl2va model if the int8 one doesn’t suit your card. The pack also includes a separate MiniMax H3 Frame Infill Ref node for the ref2va checkpoint (with reference images and the audio VAE), which I’m not using in this graph.

The Workflow at a Glance

The node author ships a small example graph that outputs the whole regenerated window. I kept that core and added the splice and mask branches on top with a Python build script, so the final output is the original video with only the selected section replaced.

LoadVideo -> GetVideoComponents -> MiniMaxH3FrameInfill -> BasicGuider -> SamplerCustomAdvanced -> VAEDecode
                                                                                        |
PrimitiveInt START / END -> ComfyMathExpression (length, first frame after)             |
                                                                                        v
ImageFromBatch: original before | generated range | original after -> ImageBatch x2 -> CreateVideo (+ source audio) -> SaveVideo  FULL FRAME EDIT
ImageFromBatch: original range + generated range + LoadImage mask -> ImageCompositeMasked -> ImageBatch x2 -> CreateVideo -> SaveVideo  MASKED EDIT

The graph has 31 nodes in total. A MarkdownNote titled “How to edit a video section” sits on the canvas with the short version of the instructions below.

MiniMax H3 Frame Infill Settings Explained

These are the exact values in my MiniMaxH3FrameInfill node:

Input My value Notes
prompt “Describe only the desired change. Keep the subject, lighting, camera, and motion continuous. No cuts or scene changes.” Placeholder text. Replace with your edit.
gap_start 86 (wired from START) First regenerated frame, inclusive
gap_end 109 (wired from END) Last regenerated frame, inclusive
width / height 640 / 640 Set to your source size, multiples of 32
mode chunk_anchors The README’s recommended mode
context_frames 0 0 = use all frames on both sides
anchor_stride 12 Only used by sparse_anchors

The node outputs positive conditioning and a latent, which go straight into the stock H3 sampling chain.

gap_start and gap_end

Both are frame numbers on a 24 fps timeline, and both ends are included. To convert seconds, multiply by 24. My default of 86 to 109 is 24 frames, which is exactly one second starting at about 3.6 s. In my graph you don’t type these into the infill node directly. Two PrimitiveInt nodes titled “START frame at 24 fps” and “END frame inclusive at 24 fps” feed the node and every slice downstream, so the generation range and the splice range can never drift apart.

Gap length matters. The README’s advice: too short and the transition motion looks unnaturally fast; too long and the middle of the gap, far from the anchors, starts to drift in appearance or H3 sneaks in a cut. Keep repairs minimal and give action changes 2 seconds or more.

The Four Infill Modes

The mode dropdown offers chunk_anchors, sparse_anchors, latent_mask and chunk_anchors+mask. The author recommends chunk_anchors, which is what I use. I haven’t compared the other modes properly yet, so I won’t make claims about them here.

context_frames and anchor_stride

context_frames caps how many frames on each side of the gap are used as reference. 0 means all of them. Lower it when the footage near the gap is itself broken (black frames, glitches), so the model doesn’t copy the damage. anchor_stride sets the spacing of still anchors in sparse_anchors mode and does nothing in chunk_anchors.

Sampler Settings

  • RandomNoise: seed 42, control “fixed”
  • BasicGuider: model plus the infill conditioning (no negative prompt)
  • BasicScheduler: scheduler simple, 20 steps, denoise 1.0
  • KSamplerSelect: euler
  • SamplerCustomAdvanced -> VAEDecode with the H3 video VAE

Why keep the seed fixed? The README says changing the seed barely changes the result unless the composition collapses. To get a different bridge, change the prompt instead. On long gaps an occasional seed breaks the composition, so in that case try a few seeds and keep the best one.

How the Splice Back Into the Original Works

This part is my addition, and it’s the reason I built the graph. The infill node generates the whole window, not just the gap. The frames outside the gap come out close to the original, but the README is clear that they’re not pixel-identical. I don’t want a re-encoded, slightly different version of the good parts, so the graph only takes the gap from the generated batch and uses the untouched source frames everywhere else.

Node (title) Source batch_index length
Original frames before edit source frames 0 START
Generated frames in edit range VAEDecode output START END – START + 1
Original frames in edit range source frames START END – START + 1
Original frames after edit source frames END + 1 4096 (rest of clip)

Two ComfyMathExpression nodes do the arithmetic: “Edit length” uses b - a + 1 and “First frame after edit” uses a + 1 on the END value. Two ImageBatch nodes then join before + generated range + after into the “Full-frame final video”. CreateVideo at 24 fps takes those frames plus the audio from GetVideoComponents, so the original soundtrack is kept and stays in sync, because the frame count never changes. SaveVideo writes it to H3_Section_Edit/full_frames.

A detail that’s easy to miss: H3 works on a 17k+5 frame grid, and the infill node rounds the window down to that grid. Because the “after” slice comes from the source frames and not from the generated batch, any trailing frames past the grid still end up in the output. That’s why the note on the canvas says the source frame count should be 17k+5 “where practical”. It helps, but the splice doesn’t break without it.

The Optional Mask for Local Edits

Sometimes you don’t want to replace the whole frame for that second, just one area like a hand, a sign or a face. That’s the second branch:

  1. A LoadImage node titled “PAINT WHITE AREA TO EDIT” (default file h3_edit_mask_blank.png). Open it in ComfyUI’s mask editor and paint the region you want to replace.
  2. ImageCompositeMasked titled “Masked replacement inside selected frames” with x 0, y 0 and resize_source on. Destination = original frames in range, source = generated frames in range, mask = the painted mask.
  3. The same before/after ImageBatch join, then CreateVideo at 24 fps with the source audio, saved to H3_Section_Edit/masked.

Be clear about what this mask is: compositing after generation. H3 still regenerates the full frame across the whole window. The mask only decides which pixels of the generated range replace the original. It’s also one static mask for every selected frame, so it suits edits that stay in roughly the same place. For a moving subject, paint a generous area that covers its whole path through the range. Use an image the same size as your video frames for the mask so it lines up.

Without a painted mask, just use the FULL FRAME EDIT output and ignore the masked one.

Step by Step: Editing One Section

  1. Convert to 24 fps. H3 is trained at 24 fps and the node expects it. For example: ffmpeg -i input.mp4 -vf fps=24 -c:a copy input_24fps.mp4.
  2. Load it in LoadVideo.
  3. Find your frames. Note the start and end time of the bad section and multiply by 24. Set START and END. Make sure there are a few seconds of footage on both sides, and keep the total window inside H3’s trained range of roughly 124 to 362 frames (about 5 to 15 seconds). Trim longer videos to a window around the edit first.
  4. Set width and height on the infill node to your source resolution, both multiples of 32. If they differ from the source, the generated frames won’t match the original frames in size.
  5. Write the prompt for the change only (tips below).
  6. Optional: paint the mask in the LoadImage node.
  7. Queue and compare FULL FRAME EDIT and MASKED EDIT against the source.

Prompt Tips for Section Edits

The prompt is optional. With an empty prompt the node simply fills the gap to match its surroundings, which is ideal for repairs. For an actual change, I describe only the change and lock everything else:

The woman stops walking and spins once in place, then continues forward.
Same outfit, same hair, same background colors. Lighting stays constant.
The camera is fixed. No cuts, no zooms, no close-ups, no scene changes.
Her full body stays in frame.
  • H3 likes to add cinematic cuts. For gaps longer than about 2 seconds, the README specifically recommends no-cut language like the last two lines above.
  • Pin appearance and background colors, because the middle of a long gap is where drift happens.
  • Write it as one continuous shot. The multi-shot structure from my MiniMax H3 prompt guide is for full generations, not for patching one second.

Memory on a 16 GB Card

Read the requirement honestly: the node’s README estimates about 24 GB VRAM for a 640×640, 8-second window with the int8 pruned set. My RTX 5080 has 16 GB, which is why my default is 640×640 and not my usual larger H3 sizes. ComfyUI will offload weights to system RAM on smaller cards, but expect it to be slow and to need plenty of RAM. What helps:

  • Trim the input to the shortest window that still leaves a couple of seconds on each side of the gap.
  • Stay at 640×640 (or the smallest multiple-of-32 size that matches your aspect ratio) and upscale the finished video afterwards.
  • Apply the fixes from my MiniMax H3 out of memory guide for 16 GB cards, such as reserving VRAM with SetReserveVRAM.

Other H3 Editing Nodes Worth Knowing

While researching this I found a few other community projects that attack H3 editing from different angles. I haven’t tested them in this workflow, but they’re worth knowing about:

  • ComfyUI-FL-MiniMaxH3: a Temporal Reshot Planner, Beat KSampler and Assembler chain with a timeline editor that normalizes the source to 24 fps and splices the replacement back with the original audio.
  • ComfyUI-MiniMaxH3-Inpaint: a “MiniMax H3 Inpaint Latent (plate + mask)” node for true latent-space masked inpainting and character swaps, used with MiniMaxH3ReferenceToVideo.
  • MiniMax H3 Inpaint Tools (panghea): partial denoise masks by track, time span or rectangle, including audio-only re-rolls.

The big difference from my graph is that the latent-mask approaches keep untouched areas fixed during sampling, while my mask composites after generation. My graph’s advantage is that it only uses core nodes plus one infill node, and the output is easy to reason about: original frames everywhere except the range you picked.

Download the Workflow

The zip contains MiniMax_H3_Video_Section_Editor_Optional_Mask.json. Unzip it and drag the JSON onto the ComfyUI canvas. The core infill chain is based on red-polo’s FL2VA example workflow (GPL-3.0). The START/END controls, splice slices, mask branch and audio routing are mine.

Download MiniMax H3 Video Section Editor Workflow (.zip)

Frequently Asked Questions

What does MiniMax H3 Frame Infill do?

It regenerates a chosen frame range of an existing video with MiniMax H3, using the footage before and after that range as anchors, so the new section connects to its surroundings. The official H3 modes don’t offer this.

Can I use the ref2va checkpoint with this workflow?

Not with the base MiniMaxH3FrameInfill node, which needs the fl2va checkpoint. The same custom node pack has an experimental MiniMax H3 Frame Infill Ref node for ref2va, with reference images and the H3 audio VAE.

Does the edited section get new audio?

No. My graph passes the source audio from GetVideoComponents into both CreateVideo nodes, so the original soundtrack is kept. The frame count doesn’t change, so it stays in sync.

Why doesn’t changing the seed change the result?

The anchors constrain the generation strongly. According to the node author, different seeds give nearly the same result unless one collapses. Change the prompt to get a different bridge.

My video is 30 fps. Can I still use it?

Convert it to 24 fps first (for example with ffmpeg’s fps=24 filter). Frame numbers in the workflow always refer to the 24 fps version.

Will the mask follow a moving object?

No. It’s one static mask applied to every frame in the range. Paint an area large enough to cover the object’s path, or use the FULL FRAME EDIT output instead.

Can this make a seamless loop?

Yes, the README describes it: place the same clip twice with a gap between them, infill the gap, then cut out one cycle. My graph isn’t set up for that layout, but the same infill node does the work.

Final Thoughts

Re-rolling a whole H3 clip to fix one second is wasteful when most of the shot already works. With the Frame Infill node doing the hard part and a few core nodes handling the splice, this graph replaces only the frames you choose, keeps the original audio, and gives you a masked version for local edits. Respect the 24 fps rule, keep context on both sides of the gap, add no-cut language for longer gaps, and keep the window small on a 16 GB card.

More H3 guides on FreakyJolly: