Nodes/ComfyUI MiniMax H3 Timeline Director/MiniMax H3 Prepare Loop Segment
ComfyUI Node

MiniMax H3 Prepare Loop Segment

Latent carry, Drift-Control and audio locking in one step

By Songssx·Created about a month ago·Updated 2 days ago· 465
MiniMax H3 Prepare Loop Segment
  • finite_plan
  • loop_state
  • segment_plan
  • positive
  • target_latent
  • model
  • sigmas
  • vae
  • audio_vae
  • Positive
  • Sampling Latent
  • Sampling Model
  • Actual Overlap Frames
iteration_index
continue_audio_latenttrue

This is the heaviest node in the native Loop set, and the one that does the actual long-video engineering. Its job, in the author's words: "Prepare one encoded H3 segment for sampling. It carries the preceding latent tail, applies Drift-Control, and locks original or muted video audio when requested by the material plan."

If you've read the Finite Segment Sampler's page, this is that node's internals cut open and handed to you as inputs. It's a graph-expansion node, so it builds a small sub-graph rather than doing everything in one Python call - which matters for troubleshooting, as we'll get to.

How it works

Feed it the current loop state and it does four things in order.

Validates. It checks that the carried state's next_iteration matches the iteration you're asking for, and that the selected segment plan's frame length matches what the plan says it should be. Both errors are specific strings, not shape mismatches - that's deliberate, and it's the difference between a five-second diagnosis and a twenty-minute one.

Continues the latent. It builds a continuation step that takes the previous segment's sampled latent and the current target latent, aligns the overlap to H3's legal grid, copies the previous AV tail into this segment's opening, and applies a linear temporal noise mask - preserved at the seam, re-noised in the disposable prefix. Then it installs the Drift-Control AV model patch with a prefix_steps value derived from the overlap's video-token count, so the mask follows whatever sigma schedule you plugged in. Special cases it handles quietly: an overlap of 0 means touching windows with no continuation (overlaps of exactly 1 route through a native Add Guide instead, which is why vae and audio_vae are required inputs here).

Locks audio, if the plan says to. If the timeline has a locked source soundtrack or muted video audio, it slices the exact interval from the plan, encodes it with VAEEncodeAudio, and swaps it into the nested AV latent with the audio noise mask zeroed - the "native AV mask/sigma path" from the README. In that case it also forces continue_audio_latent off, because there's nothing to soft-release: the audio is already fixed.

Returns the three things a sampler needs - conditioning, latent, patched model - plus the overlap it actually used.

Inputs and outputs

Required inputs: finite_plan, loop_state, segment_plan (from Select Loop Segment), positive, target_latent (from the Plan Encoder), model, sigmas, vae, audio_vae, iteration_index (force-input), and continue_audio_latent (default on).

Outputs, all four of which you want:

  • Positive - conditioning → guider. Use it on the negative side too if you're running a basic guider.
  • Sampling Latent - the carried, masked latent → your sampler's latent input.
  • Sampling Model - the Drift-Control-patched model. This one matters: if you sample with your original model instead, you lose continuation entirely and get four unrelated clips. It's the most common way to "successfully" run a loop with visible seams.
  • Actual Overlap Frames - the snapped value, for the trim decisions downstream.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/Songssx/ComfyUI-MiniMaxH3-TimelineDirector.git

Restart, search MiniMax H3. No pip dependencies declared; the pack uses PyTorch, torchaudio, PyAV and imageio-ffmpeg as already present in a normal ComfyUI install. Requirements are a recent ComfyUI with native H3 nodes, the H3 Ref2VA model, CLIP, video VAE and audio VAE, and Python 3.10+.

Common issues

Segments look independent despite the loop working. You're sampling on the unpatched model. Take Sampling Model, not your loader's MODEL.

"Touching segments require the preceding final image and VAEs." A 1-frame overlap is treated as touching windows and routes through native Add Guide, which needs previous_images, vae and audio_vae. If you meant a real overlap, your windows are effectively adjacent - widen them in the planner, because the requested value gets snapped to 1 when it's under 5 frames.

Collapsing latent error on segment two. Continuation requires matching spatial latent dimensions; keep width/height fixed for the whole chain.

Locked audio didn't lock. Locking comes from the plan, not from a switch on this node. Set it up in the Material Planner (locked original audio, or video-original-audio enabled). This node then applies the policy it finds.

CategoryMiniMax H3/Long Video/Loop

Inputs (11)

NameTypeDefaultDescription
finite_planMINIMAX_H3_FINITE_SEGMENT_PLAN
loop_stateMINIMAX_H3_FINITE_LOOP_STATE
segment_planMINIMAX_H3_TIMELINE_PLAN
positiveCONDITIONING
target_latentLATENT
modelMODEL
sigmasSIGMAS
vaeVAE
audio_vaeVAE
iteration_indexINT
continue_audio_latentBOOLEANtrue

Outputs (4)

NameTypeDescription
PositiveCONDITIONING
Sampling LatentLATENT
Sampling ModelMODEL
Actual Overlap FramesINT