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

MiniMax H3 Finish Segment Loop

Turn the loop's final state into a file you can save

By Songssx·Created about a month ago·Updated 2 days ago· 465
MiniMax H3 Finish Segment Loop
  • loop_state
  • Last Sampled Latent
  • Merged Frames
  • Merged Audio
  • Loop Status

Loop nodes hand you a carried value when they finish, and that value is not something a SaveVideo node understands. "Finish Segment Loop" is the adapter: one wire in from End Loop.outputs, four useful things out, plus the honest status line nobody reads until something's wrong.

Its description: "Convert End Loop's final carried state into the last latent and merged video/audio, including duration trimming and exact locked or muted soundtrack replacement."

That last clause is the reason to care. This is the node that decides whether your final audio is a per-segment concatenation or one continuous waveform.

How it works

First it checks the arithmetic. If the loop reported fewer completed segments than the plan asked for, it raises instead of emitting the partial chain you'd otherwise happily save. "The native Loop completed 3 of 4 segments" is a much better afternoon than a 45-second video that quietly stops early.

Then, in order:

Duration trimming. If the plan carries a target_output_frames value - which the planner sets when it padded an auto-segmented timeline to reach legal H3 lengths - it trims frames and audio back to that. This is the same job Finite Output Trim does in the sampler path, applied here once at the end.

Audio replacement. If the plan has a locked original soundtrack, it throws away the assembled per-segment audio and reconstructs the continuous source waveform at the final frame count. If video audio was muted, it substitutes a duration-exact silent track instead - so you get a silent master rather than H3 inventing replacement sound. If neither applies, you keep the concatenated Soft AV result the accumulate step built.

Then it returns the last latent, the merged frames and audio, and a status string.

Inputs and outputs

One input: loop_state, from MiniMax H3 Accumulate Loop Segment. It must be the state that came out of End Loop.outputs - the final pass's value. It validates that the state exists and that the plan inside it is a real finite plan, so feeding it an Initialize state (which never got accumulated) fails cleanly rather than with a None.

Outputs:

  • Last Sampled Latent - the final segment's latent. Rarely needed, but it's the handle if you want to post-process in latent space or continue the chain manually.
  • Merged Frames → your video saver or an upscale/post pass.
  • Merged Audio → a save-audio node. If you want the timeline's standalone reference audio instead of the soundtrack, that stream comes from the plan/encoder side, not from here - this output is the video's audio.
  • Loop Status - a string confirming the segment count and the merged frame count. Wire it to a text preview; it's cheap and it answers "did the last segment actually run" without a re-run.

Install

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

Restart and search MiniMax H3. Nothing extra to pip install - the pack declares no dependencies and uses what ComfyUI already ships. You'll need native MiniMax H3 nodes, the H3 Ref2VA model, CLIP, video VAE and audio VAE, and Python 3.10+.

Common issues

"The native Loop completed N of M segments." Your num_iterations didn't match the plan's segment count, or the loop broke early. Take the count from Initialize's Segment Count output.

"The native Loop did not produce a complete sampled segment state." Frames, audio or latent is missing from the state - i.e. the accumulate step never ran, or you're feeding Initialize's output directly into this node because you skipped the loop body.

The audio doesn't match what you heard in the previews. Check the plan's audio policy. Locked original audio and muted video audio both replace the assembled result here, at the end, so the per-segment previews will not match the final master. That's the design, and it's also why the README's digital-human path can keep a lip-synced upload intact - the source waveform is restored as one continuous piece, not stitched from slices.

Duration is a hair short. That's the tail trim to target_output_frames, measured in frames at H3's 24 fps. It exists so auto-segmented plans don't come back with padding frames at the end.

CategoryMiniMax H3/Long Video/Loop

Inputs (1)

NameTypeDefaultDescription
loop_stateMINIMAX_H3_FINITE_LOOP_STATE

Outputs (4)

NameTypeDescription
Last Sampled LatentLATENT
Merged FramesIMAGE
Merged AudioAUDIO
Loop StatusSTRING