Nodes/ComfyUI-TJ_NODE/MiniMax H3 Latent Continuation (TJ)
ComfyUI Node

MiniMax H3 Latent Continuation (TJ)

Chaining H3 clips without a VAE round-trip at the seam

By designloves2·Created 3 months ago·Updated 5 days ago· 13
MiniMax H3 Latent Continuation (TJ)
  • prev_latent
  • target_latent
  • latent
  • report
overlap_frames39
lock_audiofalse

H3's hard limit is roughly 15 seconds per clip, which means any longer video is a chain of clips. The naive way to chain them - decode the last frame of clip N to an image, feed it as clip N+1's first frame - has a hidden cost: that decode/re-encode round-trip throws away motion information, and it forces the model into a different path (FL2VA) even if you were doing reference generation. MiniMax H3 Latent Continuation (TJ) is the fix: instead of round-tripping through pixels, it stitches the latents directly.

The idea is brutally simple once you know the mechanics. You take the previous clip's sampled latent - the one you never decoded - and copy its tail K frames into the head of the next clip's empty latent. Then you mark that copied region with noise_mask=0 in both the video and audio streams. Because ComfyUI's sampler applies result = result * mask + original_latent * (1 - mask) at every step, a 0 mask is an exact, algebraic preservation: the sampler keeps the copied pixels and only generates the new, unmasked region. No VAE round trip, no motion loss, and you stay in whatever mode you were in.

The two inputs it wants:

  • prev_latent - the previous clip's undecoded sampled latent (straight out of SamplerCustomAdvanced - "SamplerCustomAdvanced 출력 그대로" is the author's own tooltip).
  • target_latent - this clip's empty H3 AV latent from the conditioning node.

And the two controls:

  • overlap_frames - how many 24fps frames of the previous clip's tail to carry over (default 39 = 1.625s, grid-aligned to H3's 17k+5 spacing). More overlap = a stronger handoff but more wasted recompute.
  • lock_audio - when on, the entire audio stream is masked to 0, which is what you want when you're using Audio Lock separately: audio stays frozen the whole chain and only video continues.

Outputs are latent (the merged, masked latent to hand to the sampler) and report (a STRING showing exactly how many video frames and audio steps were copied). There's a genuinely useful note baked into the report: in a One-Take chain you should only decode the last clip - the entire point is that intermediate clips never touch the VAE.

A couple of implementation details worth knowing so you don't mistake them for bugs. The node deliberately handles the two streams separately (.unbind() then per-stream index math) because video runs on a 24fps grid while the audio latent runs at 40 steps per second - NestedTensor indexing would otherwise apply the same index to both and drift them apart. And it makes the masks the exact shape of the latents, because if a mask shape differs, ComfyUI interpolates it and the hard 0/1 boundary blurs into a soft blend - exactly what you don't want at a seam.

This node is the low-level tool. The One-Take Sampler and the Sequencer bake the same logic in with the checkpoint save/load that makes it survive separate queue submissions; use those unless you're building a custom sampler chain. But when you want to understand why One-Take works, or you're hand-rolling a chain, this is the piece to reach for.

Install

Part of ComfyUI-TJ_NODE:

cd ComfyUI/custom_nodes
git clone https://github.com/designloves2/ComfyUI-TJ_NODE

or via Manager, then restart. No extra deps beyond ComfyUI's H3 support; you still need the H3 weights and VAE files yourself (license note: the local-weights path excludes the US, EU, UK and South Korea).

Troubleshooting

  • "overlap_frames가 0 latent 프레임으로 정렬" - your overlap value aligned to zero frames. Raise it.
  • Seam is blurry, not crisp - check that the mask and latent shapes match; if you're hand-editing masks downstream, you've likely triggered interpolation.
  • Audio and video drift at the seam - you sliced a NestedTensor directly instead of letting the node handle per-stream indexing. Feed raw latents and let it do the math.
  • You decoded every clip and the chain got expensive/slow - decode only the final clip; that's the design.
Category ✨ TJ_Node/Video

Inputs (4)

NameTypeDefaultDescription
overlap_framesINT395–362비디오 쪽 겹침 프레임 수(24fps 실제 프레임, latent 프레임 아님). 17k+5 그리드로 자동 정렬됩니다. 기본 39프레임 = 1.625초.
lock_audioBOOLEANfalsetrue면 오디오 latent 전체를 mask=0으로 고정 — Audio Lock과 같이 쓸 때 오디오는 통째로 고정하고 비디오만 이어붙이는 용도.
prev_latentoptLATENT직전 클립을 샘플링한 결과 LATENT (디코드하지 않은 것, SamplerCustomAdvanced의 출력 그대로).
target_latentoptLATENT이번 클립의 빈 AV latent (MiniMax H3 컨디셔닝 노드의 LATENT 출력).

Outputs (2)

NameTypeDescription
latentLATENT
reportSTRING