Nodes/ComfyUI-Universal_Prompt_Optimizer/Universal MiniMax_H3 分段采样器
ComfyUI Node

Universal MiniMax_H3 分段采样器

Long MiniMax H3 video without Loop nodes — this sampler builds the loop for you

By aihaipan·Created about a month ago·Updated about 23 hours ago· 2
Universal MiniMax_H3 分段采样器
  • model
  • clip
  • vae
  • audio_vae
  • finite_plan
  • media_bundle
  • prompt_finite
  • segments_json
  • Last Sampled Latent
  • Merged Frames
  • Merged Audio
  • Sampling Status
  • Video
◄duration_sec5.00►
◄width864►
◄height480►
◄audio_mode参考音色►
◄second_passfalse►
◄second_pass_model►
◄second_pass_high_steps2►
◄sampler_nameeuler►
◄schedulersimple►
◄steps8►
◄denoise1.00►
◄seed0►
◄continue_audio_latenttrue►
◄ref_image_sizematch►
◄bridge_overlaps►

H3 gives you 4 to 15 seconds per generation. Everything past that is a choreography problem: slice the idea into windows, sample them so they join without a visible cut, and stitch the picture and the audio back together. Doing that by hand is where most long-video workflows die.

UniversalH3SegmentSampler ("Universal MiniMax_H3 分段采样器") is the pack's answer, and its party trick is structural: it does no sampling itself. It expands a segment plan into a plain acyclic graph at queue time, so you get a long-video pipeline with no Loop, Loop Variable or Close Loop nodes anywhere in your workflow.

How the trick works

It's declared with enable_expand=True and builds its graph with GraphBuilder: give it N segments and it emits N chains of nodes. No hidden loop state, and everything worth inspecting is just… nodes.

Each segment runs the same four beats:

  1. Encode. An internal timeline encoder takes the CLIP, both VAEs, the segment's slice of your material plan and its prompt.
  2. Continue. A latent-continuation node applies a linear temporal noise mask seeded from the previous segment's sampled latent, carrying the latent tail forward - including the audio latent, so the soundtrack doesn't restart every cut. In the degenerate one-frame case it uses the last decoded frame as an image guide instead.
  3. Sample. Either SamplerCustomAdvanced with the sampler and scheduler you picked, or the pack's SelfLift two-stage sampler when second_pass is on. Drift-control is patched into the model on continuation segments.
  4. Finish. Video and audio are decoded through the two VAEs, the overlap frames are trimmed off the head of the new segment (with the matching audio samples), and the audio is concatenated back on. The frames accumulate into one batch.

Don't have a finite_plan? Leave it disconnected and the sampler calls the finite bridge itself to build one from media_bundle, prompt_finite and segments_json - the input is labelled 可不接 for a reason.

The inputs that matter

model, clip, vae and audio_vae are all required, and all four are genuinely required - this is an AV pipeline, not a video one with an audio afterthought.

Then the practical ones. duration_sec (1–120) sets how long you're asking for; H3 doesn't take arbitrary lengths, so treat it as a target that gets snapped to a valid frame count. width/height default to 864×480, step 32 - a sane first render before you go up. steps starts at 8, which is normal for a distilled video model. denoise has the author's own tooltip: 1.0 为全量生成, full generation. seed is shared across every segment, which is the point - consistency comes from one seed plus the latent handoff.

audio_mode gives you 参考音色 (use the reference timbre) or 强制使用音频1 (force audio slot 1). continue_audio_latent keeps the audio latent flowing across cuts; turn it off and each segment starts its audio cold. ref_image_size is match or max.

second_pass is the speed/quality dial: a low-resolution pass for most of the steps, then a high-resolution lift at the end. It has two companions - second_pass_high_steps (1–10, default 2) and second_pass_model.

The outputs

Five, and they're all useful. Last Sampled Latent for a further pass or an upscale. Merged Frames as an IMAGE batch, which is what you feed a video-combine or save node if you want your own encoding. Merged Audio for muxing. Sampling Status - a string that tells you what actually happened, and the first thing you should read when a plan goes sideways. And Video, the packaged result, if you'd rather not assemble it yourself.

Install

Manager, "Universal Prompt Optimizer", or:

cd ComfyUI/custom_nodes
git clone https://github.com/aihaipan/ComfyUI-Universal_Prompt_Optimizer.git

Restart. No pip install - the pack's single declared dependency is aiohttp, already present in ComfyUI. It needs Python 3.10+ and a ComfyUI new enough for the comfy_api.latest node API, since the whole pack is authored that way.

Where it bites

second_pass silently forces Euler. The sampler overrides your sampler choice to euler whenever the plan has second pass enabled - SelfLift requires it. Your dropdown showing something else is a lie.

The second_pass_model list can be empty. Options are pulled from models/latent_upscale_models and filtered to filenames containing both minimax_h3 and latent. Download one (the pack's own debug constant points at minimax_h3_latent_upscaler_3d_bf16.safetensors) or the dropdown gives you nothing and self-lift raises "Two-stage sampling requires a latent upscaler".

High steps must be lower than steps. It's validated, and the message tells you so: 1 or more, strictly less than the scheduler's step count. With 8 steps you have room; with 2 you don't.

Your duration isn't your duration. H3 wants 5 + 17·n frames. Ask for a nice round number of seconds and the plan rounds it to something H3 will accept, which occasionally means a hair shorter or longer than you typed.

One queue item, N segments of work. The graph is expanded per segment, so a twelve-segment plan is a large graph with twelve decodes and all the frames held in memory at once. Long plans are slow to queue and greedy on RAM. Start at two segments, get the join right, then scale.

Don't reinvent the plan. Segment count, per-segment lengths and guidance overlap live in segments_json from the optimizer. Change them upstream; hand-editing the plan is how you get the "segment count does not match the timeline windows" family of errors.

CategoryUniversal Prompt/Sampler

Inputs (23)

NameTypeDefaultDescription
modelMODEL—
clipCLIP—
vaeVAE—
audio_vaeVAE—
duration_secFLOAT5.001–120—
widthINT86464–4096—
heightINT48064–4096—
audio_modeCOMBO参考音色2 options: 参考音色, 强制使用音频1
second_passBOOLEANfalse—
second_pass_modelCOMBO0 options:
second_pass_high_stepsINT21–10—
sampler_nameCOMBOeuler44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38
schedulerCOMBOsimple9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3
stepsINT81–100—
denoiseFLOAT1.000–1降噪强度,1.0 为全量生成
seedINT00–18446744073709550000—
continue_audio_latentBOOLEANtrue—
ref_image_sizeCOMBOmatch2 options: match, max
finite_planoptMINIMAX_H3_FINITE_SEGMENT_PLAN—
media_bundleoptGH_MEDIA_BUNDLE—
prompt_finiteoptGH_PROMPT_STR—
segments_jsonoptGH_SEGMENTS_STR—
bridge_overlapsoptSTRING—

Outputs (5)

NameTypeDescription
Last Sampled LatentLATENT—
Merged FramesIMAGE—
Merged AudioAUDIO—
Sampling StatusSTRING—
VideoVIDEO—