Nodes/ComfyUI-Viggle-Animate-H3/Viggle Chunk Loop End
ComfyUI Node

Viggle Chunk Loop End

The gatekeeper that waits for each chunk to be decoded and saved before the next one starts

By Saganaki22·Created 4 days ago·Updated about 21 hours ago· 71
Viggle Chunk Loop End
  • loop
  • chunk
  • images
  • after_save
  • chunks
  • status

Viggle Chunk Loop End is the node that makes the pack's disk-checkpoint loop a loop instead of a pile of disconnected nodes. It sits at the bottom of the loop body and plays two roles at once: a barrier that refuses to advance until this chunk's decode-and-save branch has actually finished, and a gatekeeper that, when chunks remain, clones the whole loop body as the next iteration. When the last chunk is done, it hands you the collection of everything it checkpointed. If you've built graphs with ComfyUI's graph-expansion loops before, this will feel familiar - Loop Start + this node is the classic expand pair.

The context, briefly: this pack wraps Viggle-Animate, a 33B finetune of MiniMax-H3's ref2va for character replacement in video (a driving clip supplies motion, a reference still supplies identity - no prompt). Long clips are split into ~124-frame windows, and the loop renders, decodes and saves each chunk through your own nodes before the next one samples. Loop End is what enforces that ordering.

Inputs

  • loop - connect it directly from Viggle Chunk Loop Start's loop output. This raw link is how the node identifies the loop to expand. Route it through anything else and it errors.
  • chunk - from Viggle Sample Chunk's chunk output. Carries the updated loop state (plan, run name, index, saved entries) to the next iteration.
  • images - the decoded chunk, i.e. your VAE Decode's output. This wire is the actual barrier: Loop End won't proceed until the decode feeding it has produced images, which is what guarantees the next chunk can't start sampling while the previous one is still decoding.
  • after_save (optional, wildcard) - a downstream completion token, typically VHS Video Combine's filenames output. Connect it so the chunk's video file is fully written before the next iteration starts, not merely decoded. If you're saving each preview, this is the wire that makes "save each chunk before advancing" true.
  • One more: it also refuses to continue if the decoded images contain NaN/Inf - by then the latent checkpoint is already on disk, so a matching re-queue retries the decode without resampling.

Outputs

  • chunks (VIGGLE_CHUNKS) - when the loop finishes, this is the collection of all checkpointed chunks. Feed it to Viggle Assemble Chunk Latents for the single final assembly and decode.
  • status (STRING) - a plain text report ("Completed N chunks. Saved in …"). Loop completion doesn't mean the downstream final assembly/decode is done, just that the sampling loop itself finished.

Why it looks like a dead end, and the wiring

Loop End is an output node, so ComfyUI will happily draw a stop there - that's normal, not a mistake. The loop body between Start and End is what gets cloned each iteration, so the whole decode/save branch must live between those two nodes: VAE Decode's images go into images, and if you use a Video Combine for per-chunk previews, its filenames goes into after_save. Leave after_save unconnected and you risk the next chunk sampling while the previous preview is still being written.

Installing it

It ships in the ComfyUI-Viggle-Animate-H3 pack:

cd ComfyUI/custom_nodes
git clone https://github.com/Saganaki22/ComfyUI-Viggle-Animate-H3

or install via ComfyUI Manager, then restart ComfyUI and refresh the browser so the live-progress frontend loads. No pip dependencies - it runs on core ComfyUI MiniMax-H3 support, so update ComfyUI if it's older than the MiniMax-H3 nodes, and have the model files in place: the ref2va diffusion model, DMD LoRA, frozen text conditioning in models/text_cond/, and the H3 video VAE.

If something looks wrong, the README's mental model helps: this node is the execution barrier, not a sampler. A "loop completed" status means every chunk was sampled and checkpointed; it says nothing about whether your final Assembly → VAE Decode → save has run, so check downstream when you don't see an output video. And since each iteration is a fresh graph expansion, a Show Text wired to an expanded loop may only show one iteration - use Sample Chunk's built-in live progress for the running view.

Categorysampling/viggle/experimental

Inputs (4)

NameTypeDefaultDescription
loopVIGGLE_LOOP
chunkVIGGLE_LOOP_STATE
imagesIMAGEConnect VAE Decode through SaveWEBM (images output) to save each chunk before advancing.
after_saveopt*Optional completion dependency, e.g. VHS Video Combine's filenames output.

Outputs (2)

NameTypeDescription
chunksVIGGLE_CHUNKS
statusSTRING