MiniMax H3 Accumulate Loop Segment
Where the seam actually gets deleted
- finite_plan
- loop_state
- sampled_latent
- images
- audio
- Next Loop State
- Merged Frames
- Merged Audio
If you've ever stitched overlapping video chunks by hand, you know the boring truth: the hard part isn't generating the overlap, it's remembering to remove it. Every chained workflow in the Wan ecosystem has this trap, and getting the frame math wrong is what produces the "end of my video behaves weirdly" complaints you see everywhere. This node is the arithmetic.
Its description is the whole spec: "Remove the duplicated opening overlap, append decoded frames and audio, and return the state that must connect to End Loop's next_iteration_value."
How it works
Three things happen per iteration, and the order matters.
Frames. It computes trim_frames from the overlap - zero for the first segment, the H3-aligned value otherwise - slices the incoming segment's decoded frames past that overlap, and concatenates onto the carried merged timeline. The preceding segment owns the visual overlap; the incoming segment's duplicate opening is discarded. That's why the decoded result of segment two isn't simply appended.
Audio, and here it gets interesting. With Soft AV continuation on (the default for a generated soundtrack), it does not trim the incoming head. Instead it trims the accumulated audio's tail by the overlap and then concatenates - giving the incoming segment ownership of the seam so the half-cosine release the continuation applied is actually present in the final file. With fixed audio - locked original or muted - there's no soft release to preserve, so it trims the incoming head by the overlap instead. Two branches, opposite ends of the waveform, and picking the wrong one is how you get a half-second of doubled audio at a join.
State. It writes the new state: plan, next_iteration bumped by one, previous_latent set to this segment's sampled latent, previous_images set to the full decoded segment (not the trimmed one - continuation wants the untrimmed tail), and the merged frames and audio so far.
That state is the node's first output, and it goes to End Loop.
Inputs and outputs
Required: finite_plan, loop_state, sampled_latent, images, audio, iteration_index (force-input), and continue_audio_latent (default on).
sampled_latentis the sampler's latent output, before decoding is thrown away - it becomes the next segment's continuation source, which is how the chain stays in latent space.imagesandaudioare the decoded results for this segment only. Don't feed it an already-merged stream; the merge is this node's job.continue_audio_latentmust match what you sent Prepare. Mismatch it and the audio-trim branch will disagree with the mask the sampler used.
Outputs:
- Next Loop State →
End Loop.next_iteration_valueandEnd Loop.output_value. Both. The second is what lets the value escape the loop when it finishes. - Merged Frames and Merged Audio - the running totals, handy for an in-loop preview or a mid-chain save. You don't need to route them anywhere; the state carries them.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/Songssx/ComfyUI-MiniMaxH3-TimelineDirector.git
Restart, search MiniMax H3. No pip dependencies declared. You need native MiniMax H3 nodes in ComfyUI, the H3 Ref2VA model, CLIP, video VAE and audio VAE, Python 3.10+, and imageio-ffmpeg if you want the low-res monitoring proxies.
Common issues
"This segment has only N frames; cannot remove an M-frame overlap." Your decoded segment is shorter than the trim. In practice the overlap got snapped larger than you expected (24 → 22 on a short window) or the segment's frame length is too small to hold both the overlap and new content. Widen the GEN window.
"The native Loop carried state does not match the current segment iteration." The state arriving here isn't the one from the previous pass. Almost always End Loop.output_value left unconnected, so the loop restarts from Initialize every iteration - which also means every segment overwrites the previous one.
Audio has a doubled word at the join. You flipped continue_audio_latent between Prepare and Accumulate, or the plan switched to locked audio mid-run. Keep the setting consistent across both nodes for the whole chain.
Frames count lower than the sum of your segments. Working as intended - the duplicated overlaps are gone. If you want a specific duration at the end, that's Finish Segment Loop's trimming job.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| finite_plan | MINIMAX_H3_FINITE_SEGMENT_PLAN | — | |
| loop_state | MINIMAX_H3_FINITE_LOOP_STATE | — | |
| sampled_latent | LATENT | — | |
| images | IMAGE | — | |
| audio | AUDIO | — | |
| iteration_index | INT | — | |
| continue_audio_latent | BOOLEAN | true | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| Next Loop State | MINIMAX_H3_FINITE_LOOP_STATE | — |
| Merged Frames | IMAGE | — |
| Merged Audio | AUDIO | — |