Nodes/VRGameDevGirl Video Enhancement Nodes/VRGDG H3 Apply Masked Continuation
ComfyUI Node

VRGDG H3 Apply Masked Continuation

Kill the seam between MiniMax H3 scenes by freezing the previous latent

By vrgamegirl19·Created about a year ago·Updated about 23 hours ago· 819
VRGDG H3 Apply Masked Continuation
  • latent
  • context_latent
  • vae
  • latent
◄include_audiofalse►

MiniMax H3 gives you 4–15 seconds a clip. A music video is forty clips. That's the whole problem in two sentences, and it's why a node called "Apply Masked Continuation" exists with a name that sounds like plumbing but is actually the interesting bit of the whole workflow.

Here's the trick it pulls: instead of asking the model politely to continue from the last scene - a first/last-frame image anchor, which is soft, drift-prone and spends a chunk of your prompt budget - it takes the previous scene's raw sampled video latent and writes it straight into the head of the next scene's latent. Then it zeroes the denoise mask over those tokens. The sampler is told, at the tensor level, "these frames already exist, don't touch them." Everything after the head gets generated fresh.

That's a much harder anchor than an image. You're not re-encoding a JPEG back into latent space and hoping the VAE round-trip lands in the same neighbourhood - you're handing over the actual tokens the previous render ended on.

How it works, mechanically

The target latent for H3 is a joint video+audio latent, stored as a NestedTensor with a video member and an audio member. The node pulls both streams out of both inputs, copies the predecessor's video latent into out_video[:, :, :head], and builds a fresh noise_mask where the first head positions are 0.0 and the rest are 1.0. Zero means keep, one means generate.

The audio side is deliberately left alone by default, because H3 workflows for music usually drive the audio from the song. Flip include_audio on and it copies the predecessor's audio ticks into the head as well and protects them the same way - which is only correct for built-in (model-generated) audio. If you're running Audio Drive, the song is already locked in and replacing those ticks with the previous scene's is exactly what you don't want.

There's also the resize path, and this is the part nobody expects. It's extremely common for the predecessor to have been rendered at a different size than the target - every first pass of a two-pass render does that. The node can handle it two ways: with a vae connected, it decodes the head to pictures, resizes them with lanczos, and encodes them back; without one, it interpolates the latent directly. Interpolating a latent is not resizing an image, and it shows up as ghosted double edges and smeared detail. Wire the VAE. The author's tooltip says as much; the source comment is blunter about it.

The inputs that matter

Two required: latent (the target AV latent, taken after Audio Drive if your audio is locked) and context_latent (the predecessor window, which should come from VRGDG H3 Load Latent with masked_av enabled - that's the mode that slices a phase-aligned run with exactly matching audio ticks). One output, latent, which goes into your sampler.

Optional: include_audio (off by default, see above) and vae. Set both deliberately, not by accident.

Install

Via ComfyUI Manager, search vrgamedev, or Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/vrgamegirl19/comfyui-vrgamedevgirl

Then install the pack requirements with the Python that runs ComfyUI (Windows portable shown in the README):

python_embeded\python.exe -m pip install -r ComfyUI\custom_nodes\comfyui-vrgamedevgirl\requirements.txt

Fair warning: that requirements file is heavy - demucs, stable-ts, torchcodec, llama-cpp-python - because it also feeds the pack's AI Video Builder, LoRA trainer and TTS tools. This node needs none of that. It needs a current ComfyUI, which is the real dependency.

What goes wrong

The one you'll actually hit: this node requires ComfyUI 0.34.0 or newer, specifically the per-token AV noise mask work (PR 15375). The node doesn't fail mysteriously - it imports comfy.ldm.minimax.model and checks for mask_row_values, and if it's missing you get a message telling you to update ComfyUI. Update and restart. It also needs NestedTensor support, so ancient builds are out either way.

After that, it's shape errors, and each one has an answer. Batch size must be 1. Predecessor and target must have the same number of latent channels. If the context head is as long as the whole target, it refuses - the fix is a longer scene or a smaller context, and in masked mode the context frame counts worth using are 39, 90, 141 and 192. And if you see a re-encoding error about token counts, your VAE round-trip didn't land on the same temporal grid, which usually means you cropped the context to something that isn't a whole number of H3 temporal groups.

One quiet trap with include_audio: turning it on while also running Audio Drive doesn't error, it just fights. Audio comes out doubled or phase-smeared and you blame the model. Leave it off in music workflows.

CategoryVRGDG/MiniMax H3 Latent Continuation

Inputs (4)

NameTypeDefaultDescription
latentLATENTTarget AV latent about to be sampled (after Audio Drive when the audio is locked).
context_latentLATENTPredecessor window from VRGDG H3 Load Latent with masked_av enabled.
include_audiooptBOOLEANfalseAlso copy and protect the predecessor's audio ticks. Use only with built-in audio. With Audio Drive the song audio is already locked and must not be replaced.
vaeoptVAEMiniMax H3 video VAE. When the predecessor was saved at a different size than this target (every first pass of a 2 Pass render), the head is decoded, resized as pictures and encoded again. Resizing the latent itself leaves ghosting and blur. Without a VAE the latent is resized directly.

Outputs (1)

NameTypeDescription
latentLATENT—