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

MiniMax H3 Initialize Segment Loop

The seed value ComfyUI's native Loop needs

By Songssx·Created about a month ago·Updated 2 days ago· 465
MiniMax H3 Initialize Segment Loop
  • finite_plan
  • Initial Loop State
  • Segment Count

ComfyUI's native Start Loop / End Loop pair is a genuinely nice bit of core plumbing that most people bounce off, because the hard part isn't the loop - it's the fact that any loop needs a carried value to hand from one iteration to the next, and you have to build that value yourself. For a segmented MiniMax H3 chain, the value is a little state dictionary, and this node is where it gets born.

"Initialize Segment Loop" takes your finite segment plan and produces iteration-zero state: the plan itself, next_iteration at 0, and empty slots for the previous latent, previous images, merged frames and merged audio. That's it. It's a constructor with an opinion about what a segment chain needs to remember.

How it works

Two outputs, and they go to two different places on Start Loop:

  • Initial Loop StateStart Loop.initial_iteration_value. This is the value that walks the loop.
  • Segment CountStart Loop.num_iterations.

The state is deliberately opaque. You don't inspect it, you don't edit it, and if you try to feed it somewhere that isn't End Loop's carried-value sockets or the pack's own loop nodes, you'll get a validation error rather than a mystery. Every node downstream that consumes it checks next_iteration against the iteration index it's being asked for, which is the pack's way of catching a mis-wired loop early instead of three segments into a ten-minute render. That's the one real design virtue here: stale state fails loudly.

Worth knowing where this sits in the architecture. The pack has two paths to segmented long video: the one-node Finite Segment Sampler (expands an acyclic graph, no Loop nodes at all), and this native Loop set, which splits the same machinery into pieces so you can put your own nodes inside the loop body. Initialize is the entry point of the second path. If you're not sure which you want, you probably want the sampler; choose the loop set when you need to intervene per segment - a custom sampler, a preview, a save, your own filter.

The loop body, for orientation

The README's wiring is worth having in one place, since the pieces only make sense together:

Initialize Segment Loop ──state──> Start Loop.initial_iteration_value
                        ──count──> Start Loop.num_iterations

iteration_index -> Select Loop Segment -> Plan Encoder -> Prepare Loop Segment
   -> (sampler) -> decode -> Accumulate Loop Segment
Accumulate state -> End Loop.next_iteration_value AND End Loop.output_value
End Loop.outputs -> Finish Segment Loop

Note that the accumulate state goes to two inputs on End Loop. Miss output_value and you'll get a loop that runs but hands nothing back.

Install

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

Restart and search MiniMax H3. No pip dependencies - pyproject.toml lists an empty dependency array. Prerequisites are a recent ComfyUI with native MiniMax H3 nodes, the H3 Ref2VA model, CLIP, the video VAE and the audio VAE, and Python 3.10+. You'll also want the pack's third example workflow, MiniMaxH3原生Loop有限分段示例工作流.json, which demonstrates the whole chain read-only.

Common issues

"The native Loop carried state does not match the current segment iteration." The state arriving at a loop node isn't the state that node expects. In practice this is a wire feeding End Loop from the wrong place, or an End Loop whose output_value was left disconnected so the loop restarted from the initial value every pass.

num_iterations is 1 but you asked for four segments. The plan's segment_count comes from the planner, and Initialize reports it rather than deciding it. Change the segment count on the timeline, re-run the planner, and this node's second output follows.

Loop runs, output is one segment long. Same cause as above, other end: check Finish Segment Loop reported the same count as the plan. It refuses to emit a partial chain, which is the behaviour you want.

CategoryMiniMax H3/Long Video/Loop

Inputs (1)

NameTypeDefaultDescription
finite_planMINIMAX_H3_FINITE_SEGMENT_PLAN

Outputs (2)

NameTypeDescription
Initial Loop StateMINIMAX_H3_FINITE_LOOP_STATE
Segment CountINT