Nodes/ComfyUI-MiniMaxH3-PrefixStream/MiniMax H3 Trim Prefix (AV Master, Zero Flicker)
ComfyUI Node

MiniMax H3 Trim Prefix (AV Master, Zero Flicker)

Why your continued H3 clips flicker at the seam — and the trim that fixes it

By knoic·Created 2 days ago·Updated about 16 hours ago· 0
MiniMax H3 Trim Prefix (AV Master, Zero Flicker)
  • images
  • audio
  • latent
  • session
  • cache_config
  • video_latent
  • trimmed_images
  • trimmed_audio
  • trimmed_latent
trim_frames0
fps24.00
match_tailtrue

When you continue a MiniMax H3 clip, the new segment starts by replaying the tail of the last one - usually 39 to 192 frames of it, protected by a denoise mask. That overlap is what makes the transition seamless. But it's also what makes your output subtly wrong if you don't cut it off: you end up with a "video" whose opening seconds are a duplicated re-render of footage you already have. Decode the whole thing naively and you'll also see VAE flicker and color drift at the head - the model's causal VAE wasn't built to re-decode protected context a second time. MiniMaxTrimPrefix ("MiniMax H3 Trim Prefix (AV Master, Zero Flicker)") is the node that slices that overlapping prefix back off, and it does it in the right place.

Why pixel space beats latent space here

The obvious approach is trimming the latent before decoding - and you can do that (feed the latent slot). The pack's strong recommendation is the opposite: decode the full clip first, then trim images and audio in pixel/waveform space. Two reasons. First, once context has been re-sampled into a new clip, decoding a sliced latent head can carry causal VAE artifacts - flicker and tinted frames that a pixel-space crop simply never produces ("zero flicker" is not marketing, it's the mechanism). Second, trimming audio in the waveform domain keeps it sample-exact, so the sound stays in sync with the picture instead of drifting by a few frames.

The inputs that matter

  • trim_frames - set to 0 (the default) and let the node work it out. If you've connected a session from the Continuation Applier, it uses the actual protected frames that ran (which can differ from the configured 39/90/141 after snapping); if only a cache_config is present it falls back to that. You only hand-type a number when running the node standalone, away from a session.
  • images - the fully decoded current clip, straight from your VAE decode. Connect this and trimming happens in pixel space. This is the "AV Master" path.
  • audio - the decoded audio stream (from VAEDecodeAudio or a Safe VAE Decode). Trimmed in lock-step with the images.
  • session / cache_config - how the node learns how many frames to trim automatically.
  • fps - defaults to 24; used to convert frames to time for the audio cut.
  • match_tail - leave this on. H3's audio runs at 40 Hz while the video is 24 fps, and the two grids accumulate about 8 ms of rounding error per clip boundary. match_tail aligns the tail durations so those errors don't stack up across a long chain.
  • latent / video_latent - optional raw-sample trimming for when you genuinely need a trimmed latent (e.g. feeding downstream latent ops). The video_latent name is a legacy alias.

Outputs are trimmed_images, trimmed_audio, and trimmed_latent. Wire trimmed_images + trimmed_audio into your video-combine/save node - that's your clean, overlap-free, in-sync segment - and give trimmed_images to the Clip Bin Saver as the preview so the archive card shows the delivered frames, not the duplicated head.

Where people get burned

The #1 mistake is connecting images/audio but leaving trim_frames at 0 without a session - the node then has nothing to infer from and trims nothing. If you're not using the applier's session wire, type the overlap explicitly. The #2 mistake is decoding, trimming in pixel space, and then re-encoding that trimmed video back into a latent for the next continuation - the continuation always wants the sampler's full joint latent, not the trimmed output. Keep two branches: full latent to the Saver/applier for context, trimmed pixels/audio for the finished segment. On the very first clip there's no overlap, so this node is a harmless pass-through - leave it wired for consistency and it just does nothing.

Install

Manager (search "MiniMaxH3 PrefixStream") or:

cd ComfyUI/custom_nodes
git clone https://github.com/knoic/ComfyUI-MiniMaxH3-PrefixStream.git
cd ComfyUI-MiniMaxH3-PrefixStream
pip install -r requirements.txt

Restart ComfyUI and Ctrl+F5. No model files, no API - this node only needs the decoded images and audio you feed it.

CategoryMiniMaxH3/PrefixStream

Inputs (9)

NameTypeDefaultDescription
trim_framesINT00–124裁切的前置重叠帧数 (如 22 帧)。设为 0 且连接了 session/config 时将自动识别
imagesoptIMAGE【强烈推荐】解码后的完整画面。在像素空间裁切,彻底杜绝 VAE 闪烁与偏色!
audiooptAUDIO【强烈推荐】解码后的音频。精确同步毫秒级样本截断,杜绝音画不同步
latentoptLATENT原始采样 latent (可选,若已连接 images/audio 则无需裁切 latent)
sessionoptMINIMAX_SESSION
cache_configoptMINIMAX_CACHE_CONFIG
fpsoptFLOAT24.001–120
match_tailoptBOOLEANtrue尾部时长严格对齐:消除 H3 40Hz 音频与 24fps 画面约8ms的网格舍入累积误差
video_latentoptLATENT

Outputs (3)

NameTypeDescription
trimmed_imagesIMAGE
trimmed_audioAUDIO
trimmed_latentLATENT