Skip to content
Projects

ZenHG/ComfyUI-H3-Latent-Relay

View on GitHub

About

ComfyUI nodes for MiniMax-H3 multi-segment video: seamless continuation via a latent bridge (previous segment's AV latent pinned into the next segment's conditioning) — zero re-encoding. | MiniMax-H3 多段续接 latent 桥:上一段 AV latent 钉进本段 conditioning,零重编码,长视频不漂。

Design & Media

How these counts are measured

Measured star growth

in 24h
0
in 7 days
+1
in 15 days
+3
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README_EN.md

Original

ComfyUI-H3-Latent-Relay

🌐 English · 中文

H3 Latent Relay

MiniMax-H3 renders about 15 seconds per run with open weights (ComfyUI docs). This pack splices segments into one film — the previous segment's AV latent is pinned into the next one at its true position, with zero re-encoding, no decoded frames on disk, and video/audio trimmed together.

Official, as shipped This pack
Length about 15 s per run (open weights, 768p / 24 fps — ComfyUI docs) As long as your segment count: N × one segment; each segment is its own sample, Chain advances the stage number
Continuation you build it: decode the previous mp4 → VAE re-encode → use as an anchor. Lossy, drifts, can only anchor frame 0 slice the tail of the previous latent and write it into minimax_keyframes at its true position — no second VAE round trip
A/V alignment video and audio trimmed separately; the seam drifts about 0.9 s and accumulates per segment one trim for both (Trim AV), length-preserving
Extra dependencies — None: no third-party H3 node pack, no extra pip package (only the host's own torch / safetensors)

A fit for H3 films longer than 15 s spliced from segments, where the seam must not replay, jump, or change voice. Not a fit for single-shot clips (use the official template) · for raising picture quality (quality is decided by the model and weights; this pack promises nothing there) · for hosts other than ComfyUI ≥ 0.35.0 with H3 support (on older hosts the nodes still appear, but continuation silently does nothing).

Start here (3 minutes): open examples/minimal_relay_official.json → point the 4 loaders at your local files → set the stage to 0 → Queue. The four slots are UNET / text encoder (CLIP) / video VAE / audio VAE. The filenames pre-filled in the example (minimax_h3_hybrid_fl2va_ref2va_b25-49-int8 · qwen3vl_32b_minimax_h3_nvfp4 · minimax_h3_video_vae_int8_convrot · minimax_h3_audio_vae_fp32) are just one distribution set — your pruned / bf16 / fp8 builds have different names; pick whichever you have in the dropdown. The weights are not bundled: download them from the templates in the official ComfyUI H3 guide (weights live in Comfy-Org/MiniMax-H3).

🎙 The voice anchor is optional and ships unwired: the LoadAudio → VAEEncodeAudio pair in the lower left of the graph is the voice anchor, and its output is deliberately left empty — wiring it would require the author's demo clip anchor_zy.wav, which you do not have, so the first run would die on a missing file. Unwired = bit-identical to the old behaviour, so nothing blocks the first run. To lock timbre: connect the VAE's LATENT to the bridge's voice_anchor, then pick your own clip in LoadAudio (≥0.9 s, drop it into ComfyUI/input/ first).

Nothing runs? Run this first: curl -s 127.0.0.1:8188/h3relay/health — it returns pack version / API exit / registered node count / timing contract / host H3 status / torch / OS in one shot. Paste it into an issue and half the diagnosis is done.

Item Value
Version 0.6.39
License MIT (third-party attribution in THIRD-PARTY-NOTICES.md)
Host ComfyUI ≥ 0.35.0 with MiniMax-H3 support (the host itself is GPL-3.0, see License)

🔴 One iron rule (for people changing this repo): every feature has two usage paths — canvas by hand (most users) and graph JSON submitted to the API — and both must go through the same node implementation. A feature that only exists in a script is not a feature of this pack. See CONTRIBUTING.md.

What problem it solves. When generating in segments, "continuation" answers "how does the new segment know the state the previous one ended in". The mainstream approach is pixel continuation (decode the previous mp4 → VAE re-encode → use as an anchor): it costs an extra VAE round trip (lossy), the anchor is not the same object as the sampled latent (it drifts), and it can only anchor frame 0. This pack slices the tail out of the previous segment's AV latent and writes it into minimax_keyframes at its true position: no re-encoding, and no decoded-frame cache on disk (each segment only adds a ~12 MB latent sidecar under output/relay_kit/<run_id>/). Mechanism and measurements: docs/01.


Core features

11 nodes in five layers — a minimal workflow only needs the first 3:

Layer Nodes Notes
Required 3 LatentSave · CopyBridge (composite) · TrimAV without them it is not continuation
Optional 5 Post · AudioSeam · Chain · LatentUpscale · SeedFromVideo independent; since 0.6.34 they are no longer bit-exact pass-through by default (Post's settle_auto and AudioSeam's patch_seconds ship switched on — see below)
Manual routing only 1 LatentLoad the bridge fetches the source from disk itself; connect this only to override the source
Advanced 1 headless Finite Run only when you want N segments in one submission (headless / API / survives closing the browser); use Chain for everyday runs
Internal 1 Join AV do not hand-wire — only Finite Run's expanded graph connects it; to concatenate files use Chain's 🧩. Hidden from the node menu by default (enable Comfy.DevMode to see it); API / expanded graphs / saved workflows are unaffected
Node (canvas name) What it does
🔗 H3 Relay · Latent Save after sampling, writes this segment's AV latent to output/relay_kit/<run_id>/stage_NNNNN.safetensors
🔗 H3 Relay · Latent Load reads the previous segment (stage − 1); explicit_path overrides the source when resuming
🔗 H3 Relay · Copy Bridge bit-copies the previous segment's tail AV latent into this segment's initial latent + a noise mask (the pinned region is not re-drawn); with [16] conditioning connected it also pins keyframes in parallel (framing). mask_mode defaults to hard
🔗 H3 Relay · Trim AV trims the regenerated head frames (video and audio together) — without it the splice point replays or jumps; output [3] = prev_tail
🔗 H3 Relay · Post picture domain: cross-segment statistics matching / low-frequency pull / tone / deconvolution / high-frequency transfer / blur-region sharpening; settle_auto defaults to 0.5 since 0.6.34 (cures re-draw blur), the rest are off
🔗 H3 Relay · Audio Seam audio domain: extends the previous segment's ambience into this segment's head, length-preserving (zero A/V shift); on by default since 0.6.34 (patch_seconds 1.2; set 0 to disable)
🔍 H3 Relay · Latent Upscale picture domain · latent level: unpack the AV-packed latent → tile through a learned 3D upscaler → repack. Zero denoising, not one frame moved in time, audio carried back untouched (needs an optional upstream dependency — see Install)
🔗 H3 Relay · Seed from Video entry point: encodes an existing video into segment 1 (the seed segment) sidecar; later segments continue outward as usual. It blocks three traps for you: temporal grid (5+17k frames), canvas grid (multiples of 16), and A/V equal length (trim tail / zero-pad / silent seed)
🔗 H3 Relay · Chain auto-run controller: advances stage numbers and queues; since 0.6.7 it also rotates prompts (prompts split on ---) and concatenates (🧩)
⏩ H3 Relay · Finite Run advanced entry point: one submission expands segments 1..N into a single acyclic graph that the host executes in one go (no frontend button, headless-friendly). Every segment chain uses the same nodes as a manual run — the algorithm is not rewritten; from_segment re-runs only the later segments. Reference images (ref_image_1..3) are one set shared by the whole run, with refs_mode / ref_anchor_mode to pin cast and set (see docs/07 §how to feed reference images). ⚠ The merged output is one in-memory tensor ⇒ try two segments first when the segment count / resolution is high (see docs/07 §how it splits work with Chain)
🧩 H3 Relay · Join AV internal node, do not hand-wire, and not in the node menu by default (DEV_ONLY; enable Comfy.DevMode to see it): torch.cat plus strict spec validation (a spec mismatch raises instead of silently stretching). Only Finite Run's expanded graph connects it — to concatenate files use Chain's 🧩 (file path, nothing held in memory)

Three domains — do not mix them up: timeline = H3RelayTrimAV (frozen) / picture = H3RelayPost / audio = H3RelayAudioSeam.

Node labels are English-only since 0.6.18; the Chinese term ↔ label mapping is in docs/04 (Chinese).


Requirements

Dependency Required? Notes
ComfyUI ≥ 0.35.0 with MiniMax-H3 support ✅ needs comfy_extras/nodes_minimax_h3.py and a comfy/model_base.py that consumes minimax_keyframes / minimax_refs. On an older ComfyUI the nodes register but continuation silently does nothing
torch ✅ top-level import (without it the whole pack fails to register); bundled with ComfyUI
safetensors ✅ lazy import (only the save step fails if missing); bundled with ComfyUI
av >= 17 for concatenation needed by "concatenate" and tools/concat_segments.py (bundled with the host). A missing module errors explicitly with install instructions; if PyAV is too old to provide the stream-copy template it reports why and falls back to re-encoding (stated in the report) — never silent
community pack Comfyui_Minimax_h3_latent_Upscaler + its weights 🔍 upscale node only see Install · optional

minimax_keyframes / minimax_refs / resolved_frame_index are all ComfyUI native protocols: zero monkey patching, and nothing in another pack is patched.


Install

cd ComfyUI/custom_nodes
git clone https://github.com/ZenHG/ComfyUI-H3-Latent-Relay.git

Or download the ZIP → unpack → rename the folder to ComfyUI-H3-Latent-Relay → put it in custom_nodes/.

Or ComfyUI Manager → Custom Nodes Manager → search h3-latent-relay (node page: https://registry.comfy.org/nodes/h3-latent-relay). The pack name differs from the repository name because the registry forbids "ComfyUI" in a pack name.

Restart the ComfyUI backend afterwards (ComfyUI-Manager → Restart; otherwise restart the Python process) — refreshing the browser alone does not load new nodes. Search the node list for 🔗 H3 Relay (8)

  • 🔍 H3 Relay · Latent Upscale + ⏩ H3 Relay · Finite Run — the 10 visible in the menu. The 11th, 🧩 H3 Relay · Join AV, is internal and not in the menu by default (it is the tensor concat used only by the ⏩ Finite Run expanded graph; hand-wiring it has no meaning). Enable Comfy.DevMode in settings to see it. Saved workflows and API submission are unaffected (registration is unchanged).

Optional: only needed for 🔍 latent tile upscaling (not installing it does not affect any other node; using it then raises an error naming the repository and the weights):

cd ComfyUI/custom_nodes
git clone https://github.com/LBH-123-AI/Comfyui_Minimax_h3_latent_Upscaler.git   # author LBH-123-AI (MIT)

Then download the weights from https://huggingface.co/LBH-123-AI/Minimax_h3_latent_upscaler into ComfyUI/models/latent_upscale_models/ and restart the backend. ⚠️ You need the H3 latent upscaler weights (24-channel), not an ESRGAN-style pixel model.

Node API exit: V3 (default) / V1 (H3RELAY_NODE_API=v1 is a one-line fallback; restart required). Both exits have identical node names, input/output order and defaults (machine-checked field by field) ⇒ switching needs no graph edits.

Why it must be one or the other: the host loader is if the module has NODE_CLASS_MAPPINGS → return / elif the module has comfy_entrypoint ⇒ exporting both means V3 never takes effect; in V3 mode this pack therefore sets NODE_CLASS_MAPPINGS = None explicitly. V3's known difference: the schema is built at package load time (V1 is lazy) ⇒ if one node's parameter table fails to build, only that node is skipped and logged; everything else still loads (the pack never fails as a whole). Lower-bound basis (re-derived 2026-10-02 from git history): the floor is >=0.35.0, set by the pack's latest hard dependency — the mask hard-lock needs the host's mask_row_values (#15375, v0.34.0+) and the forward pass scaling masked-row velocities by the mask (#15988, v0.35.0+); every other dependency is older (H3 support itself is v0.30.0). Verified neither changed between v0.35.0 and HEAD. On the metadata side, web/ mounting (WEB_DIRECTORY, since 2023) and comfy_config parsing pyproject.toml (since 2025-06) both exist in v0.35.0 ⇒ the floor holds for behaviour and metadata. requires-python = ">=3.10" is deliberately conservative (no 3.10-only syntax is used, so relaxing it to 3.9 has no syntax obstacle).


Usage

Five-minute quickstart

Starting from an existing video? Open examples/seed_from_video_ui.json (23 nodes). Fast path: open examples/minimal_relay_official.json (notes in examples/README.md) and point the 4 loader dropdowns at your local model files.

Segment 1: ① set stage_index to 0 → ② type a prompt into the official prompt node → ③ Queue. (Do nothing else: at stage 0 the bridge passes through. Since 0.6.37 context_latent may stay empty — the bridge reads the previous segment from disk by run_id.)

From segment 2 on: ④ set stage_index to 1 (this one number only) → ⑤ replace the prompt with segment 2's content (open by picking up the previous segment's motion / camera; do not restart the action) → ⑥ Queue again. The log should show 钉住 22 帧 / 裁首 N 帧 = 钉住 22 + 沉降 0 / 起点干净.

Key parameter Segment 1 From segment 2 Set on
stage_index 0 1, 2… LatentLoad + bridge + LatentSave (all three must match; Chain syncs them)
run_id one film name, e.g. myfilm character-identical to segment 1 all six nodes that carry it (Chain / bridge / LatentSave / LatentLoad / TrimAV / AudioSeam) — on the canvas, editing one field syncs the rest of its group
context_frames 22 22 (leave alone) bridge (pin window; only 5/22/39/56/73/90/107/124)
settle_frames — (segment 1 trims nothing) keep 0 TrimAV (0 = no settle trimming, which is the recommendation)
seam_ghost / settle_sharpen — keep 0 TrimAV / Post
The three most common ways to break it Fix
Error "segment N cannot find the previous segment" all six run_id values must be identical (on the canvas, editing one field auto-syncs the rest of its group; if it does not, see docs/05); confirm segment 1 ran
The output replays the previous segment from frame 1 TrimAV is not connected, or its trim_frames is not wired to bridge [2]
A new film picks up an old film's tail run_id was not changed (same name ⇒ same file names)

Two prompt-related things this pack cares about

This pack does not generate prompts and does not parse them — the bridge and Trim AV only look at tensors. Only two things in the prompt affect this pack's behaviour:

① Voice anchor — the decision comes from the prompt

Step What drives it
Executing the anchor the voice_anchor input (LoadAudio → VAEEncodeAudio audio latent) — the node only sees tensors and cannot read the prompt, so it has no idea who speaks in this segment, or how many people do
Deciding who to anchor the prompt: <Subject N> … <d>[line]</d> is the only place where "who speaks first in this segment" can be read by machine
Speaker changes inside the segment the prompt's <Subject N> (the model switches on its own) — the anchor cannot cover this; its window is only the seam (~0.9 s)

One command gives the verdict:

python tools/voice_bank.py advise --bank <voice bank> --prompt-file segN.md --prev-file segN-1.md

Rule: the anchor is the first person who speaks in this segment; same speaker continuing ⇒ you need not connect it, speaker change at the seam ⇒ you must. If ≥2 people speak in one segment the anchor only covers the seam — the rest is up to the prompt. Details in docs/07 §Voice anchor.

② Dialogue timing at the seam — three things to write by the book

Discipline In one line
Head padding A continuation segment must leave room for "trim + margin" — never put dialogue on frame 0
Dialogue-safe moment Keep dialogue away from the seam (that region gets trimmed and pinned); place it later per the formula
Last-frame anchor chain Segment N's last-frame state must be copied verbatim into segment N+1's prompt — do not just write "continue"

Mechanism, formulas and measurements: docs/06.

Minimal wiring

prompt node (official / third-party)
  ├─ positive ──────────────────→ bridge [16] conditioning
  └─ LATENT ───────────────────→ bridge [0] latent
                                 bridge [1] context_latent  ← leave empty (auto-loads previous segment)
                                 bridge [2] context_frames  = 22
                                 bridge [17] run_id / [18] stage_index
                                        │
           bridge [0] latent ───────────┼──→ sampler latent_image      ★ MUST pass through the bridge
           bridge [3] conditioning ─────┼──→ sampler positive
           bridge [2] trim_frames ──────┼──→ TrimAV [1] trim_frames    ★ MUST be connected
                                        │
                                  sampler → LATENT ──→ 🔗 H3 Relay · Latent Save [0]
                                                 └──→ VAEDecode / VAEDecodeAudio
                                                           ↓
                               🔗 H3 Relay · Trim AV [0] images ← IMAGE / [3] audio ← VAEDecodeAudio
                                     │
                               [1] audio (optionally via AudioSeam)────→ CreateVideo → SaveVideo
                               [0] images ────────────────────────────↗

🔴 Only one audio route is correct: TrimAV [1] audio (optionally through AudioSeam [0] audio) → CreateVideo.audio. Wiring VAEDecodeAudio straight into CreateVideo desynchronizes A/V — the video drops the overlapping head frames while the audio keeps them, off by ~0.9 s per seam and accumulating segment by segment (lip-sync visibly off from segment 3 on). Nodes can detect "an input is unconnected"; they cannot detect "an output is left dangling". Any node that outputs CONDITIONING + LATENT wires up the same way — just swap it in for the prompt node. The production "first pass → 🔍 upscale → second pass → continuation" layout with all 8 nodes is in docs/03 §4.1.

Concatenating segments into one film

Every segment produces its own mp4. On the Chain node auto_concat is on by default (joins when the run finishes), or click 🧩 拼成一条 (video is stream-copied losslessly, audio is de-primed and aligned per segment, four assertions run immediately); without the canvas: python tools/concat_segments.py s1.mp4 s2.mp4 -o film.mp4 (exit 0 = four assertions passed). ⚠️ Do not use ffmpeg -f concat -c copy or acrossfade (measured: inflated duration / 0.25 s stolen per seam, accumulating). Details and audio-track levels (AAC 256k default / lossless PCM master) in docs/10 §7.1.

Cross-speaker voice timbre: voice anchor (0.6.19)

When dialogue alternates speakers per segment, the bridge feeds the previous speaker's voice (the audio tail used as audio_ref) into the next segment's generation ⇒ timbre cross-contamination (measured: same character F0 drift +15%, spectral centroid +27%). Fix = feed a voice anchor of the current segment's speaker into the optional voice_anchor input of Copy Bridge (LoadAudio → VAEEncodeAudio): not connected = bit-identical to the old behaviour; connected = timbre locked and clipping disappears (measured: distance-to-baseline shrunk to 1/5).

🔵 Both example workflows ship with the voice anchor already connected (LoadAudio → VAEEncodeAudio → the bridge's voice_anchor). The only thing you have to do is point that LoadAudio at your own character voice (≥0.9 s of clean speech, emotion close to the line; drop the file into ComfyUI/input/ and pick it from the dropdown). tools/voice_bank.py can collect anchors automatically from already-rendered segments.

A wrong anchor can never produce a bad film — four fallbacks:

Situation Behaviour
You do not want it / have no clip ready Just unplug the voice_anchor wire = bit-identical to the old behaviour (no graph or parameter change, zero migration cost)
A content-less anchor (all-zero / constant / silent / contains NaN) 🔴 Raises on the spot (fail-closed since 0.6.20). The message names the reason and tells you "unplug it to turn it off" — it never fails silently into a bad film
Anchor shorter than the window Takes the full anchor + a report reminder (≥0.9 s recommended)
pin_audio=False The anchor is ignored and the report says so (degradation is visible)

Limitations of the voice anchor:

Limitation Details
🔴 Consumes 1 "audio reference" slot The official reference node MiniMaxH3ReferenceToVideo allows at most 3 ref_audios; this pack always occupies 1 whenever stage_index >= 1 (either the anchor tail window or the previous segment's audio tail). Fill all 3 and the model sees 4 audio references — the model does not complain (it does not validate the count), but that is outside the official envelope and untested by us. ⚠️ This 1 has no "use none" switch (with no anchor wired we still use the previous segment's tail) ⇒ to free a slot you must reduce the ref_audio slots on the reference node yourself. The bridge node's title shows the warning on canvas, and the report carries the authoritative number. See docs/07 §Audio reference budget
The anchor replaces the whole audio tail window Any BGM / ambience inside that window is replaced too. If you have a music bed, mix it into the anchor first
Timbre / pace / emotion are partly pinned The anchor is not "timbre only" — emotion and pacing follow it as well. Pick a clean clip whose emotion matches the target line
The seam anchors only the first; the reference window can hold several (0.6.27) The pinned stretch at the seam (= the video pin window context_frames, default 22 frames ⇒ 0.925 s, adjustable 5/22/39/…/124) always covers only "whoever speaks next at the seam"; the audio_ref reference window since 0.6.27 auto-sizes on the anchor itself (0 ⇒ takes the full cap, ≤6 s) ⇒ wire a multi-speaker recording as the anchor and the reference holds several speakers' timbre. To name someone use the official ref_audios slots
The automatic reference window could in principle trigger recitation Since 0.6.25, with no anchor wired the window is chosen automatically (2–6 s — the official guideline is 2–12 s; we align the lower bound at 2 s and deliberately cap at 6 s, because the reference row is sampled at every step, so longer costs more VRAM and time; vs 0.93 s before) ⇒ the window is the previous segment's dialogue. No recitation observed in measurement (0.93 → 4.18 s, 4.4×, no seg-1 content per ASR), but that is one segment, one generation — listen once on dialogue-dense material; for guaranteed-old behaviour set audio_ref_seconds (0.93 = old)
🟣 Other speakers go through the official slots This pack anchors only the one at the seam. To give the other speakers a voice reference, wire their audio into the official ref_audios slots — that is the only path that emits a text label <Audio j>, which is what the prompt references (the one this pack injects is appended to the DiT side only, has no label and cannot be referenced from the prompt; the report says so). Run it through the official TrimAudioDuration to ~0.9 s first (reference rows ride through every sampling step — long references cost time). ⚠️ Ordinals count wired slots in order, not slot numbers: wire only ref_audio_2 and it is <Audio 1>; writing <Audio 3> resolves to nothing and reports nothing (when slots are non-contiguous the bridge node title states the real ordinals)
Anchor length The tail window is 0.925 s ⇒ anchor >= 0.9 s (shorter: the full clip is used and the report warns); 1–4 s recommended
🔴 A pause at the anchor's tail costs you timbre fidelity _voice_anchor_tail on the consumer side takes only the last 0.925 s of the anchor (a_frames/FPS) ⇒ silence at the tail is silence the model sees (that part of the anchor is effectively no anchor at all). voice_bank.py prefers spans whose tail window is fully voiced and, when it cannot, says so in the report and in voices.json's tail_clean ("timbre condition will degrade"). Seeing that warning means the source's continuous speech is too short — use a longer, cleaner single-speaker clip
🔴 Raising the anchor's sample rate does not raise the timbre ceiling The anchor is finally fed to the H3 audio VAE (native 32 kHz). A higher sample rate preserves the spectrum that is already there; it does not invent high frequencies that were never captured — measured, moving the anchor from 16 k to 32 k raised the −40 dB bandwidth from 4.7–5.3 kHz to 9.0–10.5 kHz, but beyond that the source is the limit: the audio tracks H3 itself produces only reach ~4.9 kHz of usable bandwidth (H3 can output 15 kHz, but those clips are sound effects / ambience, not speech). ⇒ A better voice means a better source (a real person / the original recording), not a higher sample rate
Ignored when pin_audio=False Stated in the report (degradation is visible, never silent)

⚠️ One common mis-wiring: never feed context_latent into voice_anchor — that is the previous segment's AV latent, so using it as the anchor just sets the anchor source back to the default "previous segment's audio tail" ⇒ it looks enabled but is a no-op (and it bypasses the audio-grid reconciliation). The anchor source must be this segment's speaker.

🔵 What if several people speak in one segment? The anchor answers exactly one question: "who speaks next at the seam". ⇒ the anchor is the first person who speaks in this segment; same speaker continuing ⇒ you need not connect it, speaker change at the seam ⇒ you must. Later speaker changes inside the segment are handled by the prompt's <Subject N> (the anchor cannot cover them).

📋 Ensemble scenes (many segments, many characters, low overlap between segments) — the full decision table + audio-reference budget ledger + degradation order are in docs/07 §Ensemble scenes: one table answers "N people speak in this segment ⇒ how to wire the anchor and split the budget".

Other speakers' voice references: official slots + <Audio j> in the prompt (format rules)

This pack's voice anchor covers only the one at the seam, and it has no text label (it is appended to the DiT side after tokenisation) ⇒ the prompt cannot reference it. To give the other speakers their own voice references you must go through the official reference node — three steps:

  1. Run that speaker's audio through TrimAudioDuration to ~0.9 s (reference rows ride through every sampling step, so long references cost time).
  2. Wire it into the official MiniMaxH3ReferenceToVideo ref_audios.ref_audio_N slot (not this pack's bridge node).
  3. Reference it in the prompt with <Audio j> — the label is emitted by the official node at tokenisation time, in wired order, 1-based.

🔴 Three format rules (getting them wrong does not raise an error — it just silently does nothing or resolves to nothing):

# Rule Note
1 The ordinal is the j-th wired slot (ascending slot number), not the slot number See the table below. When slots are non-contiguous the bridge node title states the real ordinals (it stays silent otherwise)
2 The one this pack appends (anchor / previous segment's audio tail) has no label ⇒ the prompt cannot reference it; the report states its DiT-side ordinal = official count + 1
3 Placement: the same tag family as <Picture i> / <Video k> (official: Use the same tags when prompting) Putting it next to the matching <Subject N> definition / line is the most direct

Ordinal mapping (the easiest and completely silent trap):

Slots you actually wire What the prompt should say Cost of getting it wrong
ref_audio_0 + ref_audio_1 + ref_audio_2 <Audio 1> / <Audio 2> / <Audio 3> Ordinals match slot numbers — fine
only ref_audio_2 <Audio 1> writing <Audio 3> ⇒ resolves to nothing, nothing reports anything
ref_audio_0 + ref_audio_2 <Audio 1> / <Audio 2> same as above

⚠️ Rules 1 and 2 are confirmed by reading the source (the tokenizer emits labels in enumeration order; this pack appends via conditioning_set_values). For rule 3, which wording works best has not been A/B tested yet — rely on rules 1 and 2. Mechanism and source references: docs/07-chain.md §Several speakers in one segment.

Want segment 2 to reproduce everyone's voice? One slot is enough (0.6.25; anchors work too since 0.6.27)

The route above (official slots + <Audio j>) is for "naming who is who". If what you want is "bring the whole timbre over without naming anyone" (multi-anchor, one single audio-reference slot) — use audio_ref_seconds:

Old behaviour Since 0.6.25
How much audio goes in that one slot = the video pin window (22 frames ⇒ 0.93 s — room for the last speaker only) 2–6 s automatically (walks back until 2 s of voiced content; the official guideline is 2–12 s — our cap is deliberately 6 s to save VRAM and time)
Slot budget 1 still 1 (unchanged)
  • No number to type: 0 = automatic, the material decides (min_voiced_s = 2 s of voiced, cap 6 s).
  • No anchor wired ⇒ the source is the previous segment's audio tail (the "everyone in segment 1" route).
  • 🔵 An anchor works too (0.6.27) ⇒ the source is the anchor itself; 0 = automatic window sized on the anchor's voiced tail (takes the full cap, ≤6 s — a longer single-speaker reference holds the timbre better) ⇒ wire your own multi-speaker recording as the anchor to "bring everyone" without depending on who was in the previous segment. The pinned 0.925 s at the seam is unaffected.
  • ⚠️ Cost: with no anchor the window is the previous segment's dialogue ⇒ the model could in principle recite it. Not observed in measurement (0.93 → 4.18 s window, 4.4×, no seg-1 content per ASR; the same criterion hits seg-1 keywords 3/3 on control samples) — but that covers one segment, one generation. (With an anchor the window is that speaker's own speech ⇒ far lower recitation risk.) To have a prompt address a specific person you still need the official slots above.
  • The two routes are complementary, not conflicting: "bring everyone" ⇒ this parameter; "name someone" ⇒ official slots; "pin the timbre and own the seam" ⇒ the voice anchor.

Mechanism, the division of labour between the three channels, and the measured numbers: docs/07-chain.md §Several speakers in one segment ⑥.

Implementation details and more (audio-reference budget, BGM, emotion, multi-speaker segments) in docs/07-chain.md §Voice anchor; bundled auto-collector tools/voice_bank.py (optional ASR dialogue guard — works without funasr too).

Node Chinese/EN toggle (0.6.28, canvas button)

Every node of this pack now carries a small 「中 / EN」 button: one click switches the titles, parameter labels, port names and hover tooltips of all 11 nodes (one of them hidden by default) between Chinese and English (dropdowns show Chinese while their stored value stays untouched).

  • It follows the official language setting by default (Settings → Language, i.e. Comfy.Locale) ⇒ an English UI does not get Chinese node labels; clicking the button overrides that, and once overridden the official setting no longer clobbers your choice (remembered in the browser). One-way: changing the official language makes our nodes follow; our button changes only this pack's nodes and never writes the official language setting (writing it makes ComfyUI reload the current workflow — an unacceptable cost).

  • 🔴 Display only, never the graph: only label / title / widget.tooltip are touched, never name and never a dropdown's values ⇒ not one byte of the workflow JSON changes. A title you renamed yourself is kept.

  • Hover tooltips are now condensed to "what the parameter does + the recommended value" (trimmed from up to 1084 chars to 150; the history stays in docs/); a parameter not in the table keeps the backend original and is never garbled.

  • It coexists with the audio-reference-budget hint: only the name part of the title is swapped, so a budget hint appended after it survives.

  • 🔴 It competes for the same fields with interface translation plugins (ComfyUI-Chinese-Translation, Global Translation & co.) — and this pack ships a per-frame anti-overwrite guard, measured to win against 344 overwrite attempts with zero losses. Why it is needed: those plugins run a 1-second watchdog poll that rewrites node labels/tooltips back to Chinese using their own dictionary (their source comment says it exists to "re-patch node slot labels overwritten by third-party extensions"), and they do not shield the English UI at all. This pack's countermeasure: record the expected value when writing, then compare and rewrite every frame (frame rate ≫ their 1 Hz) — so what you see is ours.

  • 🔴 UI-only: a script submitting JSON (/prompt) never touches the canvas ⇒ no button there (and nothing is lost).

  • 🔴 After upgrading you must reload the browser page (F5). Restarting the ComfyUI process is not enough: the front end is a single-page app, and once the page is open the extension JS stays resident in memory — without a reload you are still running the old version. Someone already mis-reported "tooltips are still Chinese" this way (new version on disk, old one in the browser).

  • 💡 Editing the code for local verification: a machine may have more than one ComfyUI installed (e.g. a standalone build plus a desktop build). Before claiming "my change did nothing", confirm which copy port 8188 is actually serving:

    curl -s http://127.0.0.1:8188/extensions/ComfyUI-H3-Latent-Relay/relay_kit_i18n_ui.js \
      | grep -c '<an identifier that exists only in the new code>'   # 0 ⇒ still the old copy
    netstat -ano | grep ':8188.*LISTENING'  # take the PID ⇒ look up that process's exe path
    

    "I synced the file over" ≠ "the host is reading the copy I synced".

Details and the word table: docs/04 §Node Chinese/EN toggle.


Repository layout

ComfyUI-H3-Latent-Relay/
├── __init__.py            # entry point: /h3relay/concat route, V1/V3 exit selection, startup banner
├── relay_core/            # business core (single source of truth, 11-file package): timing grid / copy bridge / TrimAV / AudioSeam / concat
├── nodes.py               # node layer (the 11 nodes' inputs, outputs and human-readable reports)
├── layout_contract.py     # layout contract: pass through + leave a trace when upstream is missing, raise only on a real mismatch
├── v3/                    # V3 shell (io.ComfyNode + comfy_entrypoint); V1 goes through NODE_CLASS_MAPPINGS
├── exp/history_anchor_v2/ # E1' time-invariant history anchor (top-level import ⇒ required; inert without _tiha.json)
├── web/                   # front-end JS: the 🧩 concat button, Chain panel, `run_id` one-field-syncs-the-group, **the node Chinese/EN toggle** (canvas only)
├── examples/              # three openable workflows: minimal continuation (21) / full flow (47) / seed from video (23)
├── docs/                  # deep docs 01–10 (mechanism / parameters / sampling / canvas / troubleshooting / scripting / chain / tests / metrics / audio)
├── tests/                 # offline self-test (zero GPU): 632 assertions + V3 parity + prompt-dispatch pure functions
├── tools/                 # self-checks / forensic tools / concat CLI / bundler (incl. the en_sync docs gate)
├── licenses/              # third-party license texts shipped with the pack
├── dist/                  # bundler output (minimal distribution set + zip; not tracked)
├── pyproject.toml         # metadata (the host really reads requires-comfyui / deps; Comfy Registry reads name / Icon / PublisherId)
├── .comfyignore           # what `comfy node publish` ships (without it docs/tests/tools go to users too)
├── icon.png / icon.svg    # Registry / Manager card icon (400×400; the `.svg` is the source, `.png` is shipped)
├── banner.png / banner.svg # Registry node-page banner (21:9 = 1680×720; same source/render split)
├── requirements.txt       # dependencies for ComfyUI-Manager
└── (top level also has README_EN.md · CHANGES.md · CONTRIBUTING.md · AGENTS.md · SECURITY.md ·
     CODE_OF_CONDUCT.md · THIRD-PARTY-NOTICES.md · LICENSE · .github/)

At runtime only __init__.py · relay_core/ (11 files) · nodes.py · layout_contract.py · v3/ (4 files) · exp/__init__.py and exp/history_anchor_v2/ (3 files) · exp/voice_accum/ (3 files) (all imported at the top of nodes.py, hence required) · web/ (7 JS files) are actually loaded — the minimal distribution set in dist/ is exactly those plus examples and metadata; docs/, tests/ and tools/ are development-only.


Configuration & hard rules

# Hard rule
1 run_id must match character-identically across all six places (LatentSave / bridge / LatentLoad / TrimAV / AudioSeam / Chain). On the canvas, editing one field auto-syncs the rest of the group (a name conflict blocks the run and lists which node holds which name — it never guesses); a script submitting JSON should write that field from a single variable (see docs/10 §7.4). Run segments in order, never skip
2 Segment 1 needs nothing special: the bridge passes through; since 0.6.37 context_latent may stay empty (the bridge fetches the previous segment), and a wire still wins
3 🔴 Audio must come from TrimAV (or AudioSeam) output; never wire VAEDecodeAudio directly into the save node (~0.9 s per seam, accumulating)
4 context_frames only accepts 5+17k (5/22/39/56/73/90/107/124) and must be smaller than the segment length; out-of-range values raise instead of snapping
5 Production mask_mode = hard (zero re-draw in the pinned region); taper does not pin and is a control arm only
6 Keep settle_frames = 0: measured, "trimming the settle" is what causes jumps at the seam. To cure blur use Post's settle_sharpen / settle_auto (picture-domain fix, no timeline change ⇒ cannot introduce a jump)
7 patch_seconds ≤ 1.2 (AudioSeam): enough to cover the 10 ms decoder silence at the head; use 0 when dialogue sits at the very head. Shortening the patch is the primary defence for dialogue; the guard is only a backstop
8 🔍 Upscale once per chain: this pack's upscale node and the one built into third-party progressive samplers (SelfLift etc.) are the same operation — enabling both upscales the same latent twice
9 chunks=1 is the only path consistent with upstream whole-segment inference: chunks>1 changes the picture (3D volumetric attention is cut); raise it only under OOM and re-check the seam
10 🔴 The continuation contract is taken in the native domain: LatentSave goes before the upscale; the second pass's guider must not connect the bridge's conditioning (different grid ⇒ it explodes)
11 diagnostics is off by default (three print-only passes, no effect on trimming); enable it for DTW / trim-amount→jump curves / appearance drift. ⚠️ The "settle 1" seen in older posts is pre-0.5.0 — trust this page and the node reports
12 🔴 The canvas path and the script path must be the same node implementation (see the iron rule at the top); purely front-end capabilities (the 🧩 button, Chain panel fields, the run_id one-field-syncs-the-group behaviour, the node Chinese/EN toggle, the stage_index push-to-all behaviour, auto re-enabling a bypassed "read previous latent", the audio-reference budget badge) are ignored when a script submits JSON. ⚠️ The last three are not dead ends — each has a non-UI route: write the same stage number into every node yourself (the Chain stage_index tooltip and docs/10 §7.4 both say so); do not bypass "read previous latent" (keep mode at 0, then Chain never has to restore it); read the budget from the bridge's report output (the very same numbers the badge shows). The rest take the three non-UI paths in §7.4

License and attribution

  • This pack = MIT (LICENSE): commercial use, modification and redistribution allowed; keep the copyright notice.
  • Third-party sources and credits: THIRD-PARTY-NOTICES.md (including the fact that the runtime host ComfyUI is GPL-3.0, and our position on it).
  • ⚠️ About H3RelayMotionContext (GPL-3.0): its anchor-synthesis part overlapped in expression with that pack in the public history of v0.2.1–v0.5.0. It was rewritten wholesale on 2026-09-19 and the current version contains none of its derived expression; the historical commits were not rewritten and can be checked out for review (NOTICES §一·B) ⇒ for strict compliance use ≥ 0.6.0.
  • Model weights are not included: bring your own MiniMax-H3 weights; their licence and commercial terms are set by their provider.
  • Compliance: this is a general-purpose video generation tool. Users must obey local law and the licences of the models/materials they use; do not use it to forge likenesses, spread disinformation, or infringe the rights of others. MIT provides no warranty of fitness.
  • This pack is not an official MiniMax product and is neither affiliated with nor endorsed by MiniMax or ComfyUI.
  • When redistributing, keep LICENSE · THIRD-PARTY-NOTICES.md · licenses/ alongside the pack.

Documentation index

The Chinese documents are the source of truth; README_EN.md and the English docs/01–docs/10 are derived artifacts, machine-checked section by section by tools/en_sync.py (edit the Chinese source and the gate stays red until the English follows).

Document Content
docs/01-mechanism.md · 🇬🇧 English history and trade-offs of both continuation routes · protocol sources · which line stays in the native domain after upscaling · timing grid · why the head must be trimmed · runtime contract
docs/02-parameters.md · 🇬🇧 English full parameter manual (bridge / TrimAV / Post / AudioSeam / 🔍 upscale, every advanced item and default)
docs/03-sampling-and-design.md · 🇬🇧 English sampling-chain trade-offs · §4.1 full-flow layout: all 8 nodes present
docs/04-canvas-and-widgets.md · 🇬🇧 English canvas appearance · advanced folding · missing prev_tail on older graphs
docs/05-troubleshooting.md · 🇬🇧 English complete troubleshooting table · FAQ · workflow-file self-check · API submission
docs/06-continuity-scripting.md · 🇬🇧 English prompt-side discipline: head padding · dialogue-safe timing · last-frame anchor chaining
docs/07-chain.md · 🇬🇧 English the Chain auto-run controller (prompts / concat / resume)
docs/08-testing.md · 🇬🇧 English offline self-test: 36 assertion groups (632 assertions) · tool inventory
docs/09-metrics.md · 🇬🇧 English reference ranges for observables (DTW residual / appearance drift) · self-calibration
🇨🇳 docs/10-audio-seam-and-concat.md audio seam & multi-segment concatenation — Chinese only for now: seam conventions and tuning guide · dialogue protection · criterion limits · track levels · sidecars · script usage without the canvas
RELEASE-NOTES.md user-facing release notes (bilingual, one section per version) · read this before upgrading
CHANGES.md version history with the measurement evidence for each change (the developer record)
CONTRIBUTING.md dev environment · the change loop · testing discipline · English-doc sync discipline · licence terms
AGENTS.md entry point for agents working on this repo: the change loop · the three verification tiers (local / CI / host + browser) · rule-to-enforcement map · the full machine-check list · forbidden moves · known weak spots
RELEASING.md release policy (single source of truth): GitHub + Comfy Registry must be updated as a pair · one command tools/release.py · failure handling · key discipline
SECURITY.md secrets / dependencies / network behaviour disclosure
tools/README.md the 20 scripts and their expected values (15 self-check/forensic + concat CLI + bundler + releaser + voice-bank collector + browser smoke gate)
examples/README.md the three openable workflows (minimal continuation 21 / full flow 47 / seed from video 23 nodes) · generators
README.md Chinese source of truth (install / wiring / nodes / parameters / troubleshooting / FAQ) — in-depth derivations always link out to that file and docs/

Explore related projects

Loading…