MiniMax H3 Video Extend (Backported)
MiniMax H3 video-extend backported to stock ComfyUI
- clip
- vae
- context_latent
- audio_vae
- first_frame
- last_frame
- ref_images
- ref_audio
- positive
- latent
The 5-second problem, solved sideways
MiniMax H3 gives you excellent 4–15 second clips with native audio, but "excellent 15 seconds" still isn't a scene. Continuation - feeding the tail of one clip back in and generating the next chunk off it - is the standard way people get longer takes out of video models, and stock ComfyUI simply doesn't have it for H3. Not as a missing node, as a missing capability: ComfyUI's PackedLayout positional-encoding code hard-rejects any keyframe anchor that isn't frame 0 or the last frame, raising ValueError("only first/last keyframe anchors are supported"). You literally cannot express "continue from this clip's ending" on a stock install.
That's the gap this pack exists to close. MiniMaxH3VideoExtendPatched is the backported, directly-draggable version of MiniMaxH3VideoExtend, which only ships on kat3ri/ComfyUI's fork. It takes a prior clip's AV latent plus a prompt, and hands back the conditioning + latent you feed to the sampler to produce the next segment. One trap to head off: this node doesn't sample - it emits positive and an empty latent for the sampler. Drag it in alone and nothing happens.
How it works
At import time the pack monkey-patches two places in ComfyUI's H3 code - PackedLayout.__init__ and MiniMaxH3.extra_conds - and only if the native extend class is genuinely absent, so it never fights a real fork.
- The trailing latent frames of
context_latentbecomecontextkeyframes, placed at negative RoPE-time positions counting backward from the new clip's own frame 0 (audio frames land on their own negative track). This is the part stock rejects. extra_condsgets a real bug fix: stock overwritescond_video_latentsfrom references instead of appending to what keyframes contributed, silently dropping context whenever both are present. The patched version appends - that's what makes extend-with-references work at all.pin_last_framedecodescontext_latent's true trailing pixel frame and pins it as this call's frame 0. That matters becausecontext_framesonly carries whole latent frames, each spanning 1–4 pixel frames - without the pin, the continuation can re-play a moment that already happened.
The canvas is inherited automatically (latent dims × 16), so you can't mismatch resolution between clips.
The inputs that matter
Only a few of these will you actually touch on a first run:
context_latent- the AV latent of the prior generation to continue from. On stock ComfyUI that comes fromMiniMaxH3EncodeAVPatched, which is how you feed in an externally loaded clip viaVHS_LoadVideo.length- frame count at 24 fps for the continuation only, excluding context. Default 124 (~5s); note the step of 17, H3's temporal token cycle.context_frames- how many trailing latent frames of the prior clip carry over. Default 2. This is the one knob from the README's recommended set you can actually reach here - the richerref_spacing/ref_decay/ref_ramptuning from the README belongs to the fork's native node, not this backport.pin_last_frame- on by default; disable only if you're feeding an exactfirst_frame.first_frame/last_frame- exact images to pin frame 0 and the segment's final frame.last_frameis this pack's own addition (the native fork has no end-anchor at all) - the "land on the next shot" lever.ref_images- reference images as a single batched socket (useImageBatchfor more than one); each frame becomes its own<Picture i>reference. Not the native node's autogrow slots.audio_vae+ref_audio- for reference audio; connectaudio_vaeor you'll get aValueError.
Outputs: positive (CONDITIONING) and latent (LATENT). Decode with VAEDecode + VAEDecodeAudio, save with SaveVideo/CreateVideo.
Install
One clone, same as the rest of the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/kat3ri/ComfyUI-MiniMax-H3-Extend
# restart ComfyUI
Or grab ComfyUI-MiniMax-H3-Extend from ComfyUI Manager. No extra pip deps, nothing edits core ComfyUI - everything is monkey-patched in memory, so uninstalling is deleting the folder and restarting. You still need the H3 stack (MiniMaxAI/MiniMax-H3, ~42.5 GB, plus the H3 video VAE, audio VAE, and CLIP) and a ComfyUI that already supports H3. And the licence caveat applies regardless of install method: the H3 Community License excludes the US, EU, UK and South Korea from running the local weights.
Common issues
- You still see
only first/last keyframe anchors are supported. That's the exact error this pack exists to fix. If it shows, the patch didn't apply - you're on a ComfyUI with native H3 extend already (the pack self-skips) or your ComfyUI is too old for H3 at all. MiniMax H3 supports batch size 1. Don't batchcontext_latent; batchref_imagesinstead - that's what it's for.- The continuation replays a moment from the old clip. Usually
pin_last_framewas switched off. Keep it on; it decodes the true trailing pixel frame. - It's slow or OOMs. H3 is 33B - context and references cost real VRAM on top of the base load. Drop
context_frames, trimref_images, and be honest about your card.
Confirmed working by the author across text-to-video, reference-to-video and cast-to-video continuation - but this is a brand-new, one-person backport of subtle positional-encoding math, so treat your first render as a smoke test. Start at context_frames 2 and add references one at a time.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| vae | VAE | — | |
| context_latent | LATENT | AV latent output from a prior MiniMax H3 generation to continue from | |
| prompt | STRING | — | |
| length | INT | 1245–3600 | New frame count at 24 fps for the continuation only (excludes context_frames) |
| context_frames | INT | 21–64 | Trailing latent frames of context_latent carried over as context |
| pin_last_frame | BOOLEAN | true | Decode context_latent's true trailing pixel frame and pin it as this call's frame 0. Ignored if first_frame is connected. |
| audio_vaeopt | VAE | — | |
| first_frameopt | IMAGE | Hard-pin this call's frame 0 to an exact image (e.g. the prior clip's real last output frame) instead of pin_last_frame's decode | |
| last_frameopt | IMAGE | Pin this continuation segment's own final frame to an exact image -- e.g. to land precisely on a known next shot/keyframe instead of leaving the ending fully generated. Not part of the native fork's VideoExtend node (which has no end-anchor at all); added here since it's a natural, low-risk extension of the same PackedLayout mechanism first_frame/context already use. | |
| ref_image_sizeopt | COMBO | match | 2 options: match, max |
| ref_imagesopt | IMAGE | Reference image(s) -- connect a batch (e.g. via ImageBatch) for more than one; each frame becomes its own <Picture i> reference. Not the native node's per-slot Autogrow inputs -- this is a single batched socket. | |
| ref_audioopt | AUDIO | One standalone reference audio clip |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| positive | CONDITIONING | — |
| latent | LATENT | — |