ComfyUI Node

H3 Sparse Chain Stitch

Stitch a half-rendered H3 chain into one MP4 without re-rolling anything

By Ltamann·Created 9 days ago·Updated about 19 hours ago· 32
H3 Sparse Chain Stitch
  • chain_config
  • audio
  • VIDEO
chain_idh3_auto_chain
fps24.000
chunk_seconds3.5
total_frames0

Long H3 chains die before they finish. You render clips 1 and 2, your GPU gives up, or you deliberately skip ahead and only render clips 2-4 because clip 1 and 5 already exist. Whatever the reason, you're left with a folder of numbered clip MP4s and no final video. H3 Sparse Chain Stitch exists for exactly that moment: it joins whatever clip files exist, in timeline order, and skips the gaps. No re-generation, no re-rolling the clips you already have.

It's part of TBG______'s (Ltamann's) H3 Motion Context Auto-Chain addon, and it's the "cleanup" sibling of the main H3 Auto Chain + Stitch node. That node saves clips, requeues the next one, and stitches at the end of a full automatic run. This one does only the stitching, and it's built for chains that are - you guessed it - sparse.

How it works

The node resolves your chain_id into a run name, then scans output/video/ for files matching <chain>_clip_NNN.mp4, sorted by clip number. Missing numbers are skipped without complaint. It then shells out to ffmpeg (via imageio-ffmpeg) and concatenates everything with libx264, crf 18, yuv420p, AAC at 192k into output/video/<chain>.mp4.

Two distinct modes, depending on whether you connect chain_config:

  • With chain_config (from the pack's chain-audio node) - it inherits the run name, FPS, and planned clip timing. If you also connect the full audio, it slices the original source audio to the frame-aligned ranges that belong to the clips you actually have, so the result matches your intended timeline instead of being a lumpy re-concatenation of each clip's own audio.
  • Standalone - it uses each saved clip's actual duration (total_frames = 0 means "use the complete durations of the saved clips"). You can set total_frames to a target if you know the exact frame budget.

One nice safety touch: it refuses to stitch clips with mismatched resolutions. A chain that changed resolution mid-way just gets a clean error instead of a subtly broken MP4.

The inputs that matter

  • chain_id - the string that names the chain (default h3_auto_chain). Must match the chain you rendered, or it finds nothing and throws FileNotFoundError.
  • total_frames - default 0 uses the saved clips' full durations. Set it only when you need to force a specific frame budget in standalone mode.
  • chain_config - optional, but connect it whenever you can; it's the difference between guess-timing and frame-accurate timing.
  • audio - the complete original source audio. Connect it (with chain_config) for gap-free, frame-aligned audio. Leave it out and you get each clip's own audio concatenated.
  • fps / chunk_seconds - defaults are 24 and 3.5. In standalone mode they only matter for aligning to planned boundaries; with chain_config connected they're overridden by the chain's own values.

Output is a single VIDEO, and this node is marked as an output node, so it'll show up in your results panel.

Installing it

Same story as every node in this pack: ComfyUI 0.34.0 or newer is required (it leans on native H3 anchor/keyframe handling rather than patching ComfyUI), and you install the pack normally:

cd ComfyUI/custom_nodes
git clone https://github.com/Ltamann/ComfyUI-H3-Motion-Context-Auto-Chain-addon

Restart ComfyUI, or search "H3 Motion Context Auto-Chain" in ComfyUI Manager. Dependencies (imageio-ffmpeg, numpy, Pillow, safetensors) are declared in pyproject.toml. You'll also need a working local MiniMax H3 setup - and remember the MiniMax H3 Community License excludes the US, EU, UK and South Korea from running the local weights.

Common issues

  • "No completed clips found" - the chain_id doesn't match your rendered clips, or the clips aren't in output/video/. Double-check the exact chain name.
  • Final video is shorter than the source audio - expected, not a bug. The README says so outright: a sparse stitch includes every matching clip and skips missing numbers. Render the missing clips with the same chain_id and stitch again for a complete timeline.
  • Mismatched resolution error - you changed resolution mid-chain. Start a new chain with a new chain_id; the addon never mixes resolutions.
  • On Windows, a stitch fails to overwrite the output file - something (a preview, Explorer, a browser) has the old MP4 open. Close it, or use a fresh chain_id.

If you're running a full uninterrupted chain, use H3 Auto Chain + Stitch and let it do the final stitch automatically. But the moment you render sparsely - and everyone does eventually - this node is the one that turns your scattered clips into a finished video.

Categoryconditioning/minimax

Inputs (6)

NameTypeDefaultDescription
chain_idSTRINGh3_auto_chain
fpsFLOAT24.0001–240
chunk_secondsFLOAT3.50.1–600
total_framesINT00–100000000 uses the complete durations of the saved clips.
chain_configoptH3_CHAIN
audiooptAUDIO

Outputs (1)

NameTypeDescription
VIDEOVIDEO