Nodes/ComfyUI-UtilsCollection/H3 Reference Video Components
ComfyUI Node

H3 Reference Video Components

Turn Any Clip Into H3-Ready Frames, Audio and Length

By silveroxides·Created 3 months ago·Updated about 12 hours ago· 35
H3 Reference Video Components
  • video
  • frames
  • audio
  • width
  • height
  • length
  • video
megapixels0.258
duration_seconds0.0
start_at_timestamp0.0

Reference video for MiniMax H3 is fussier than it looks. The model wants 24 fps frames, it wants a frame count that matches its own supported lengths, the audio has to be at its sample rate - and ComfyUI's own H3 audio path has a cropping quirk that eats the start of short clips. H3 Reference Video Components (class UC_MiniMaxH3RefVid) exists so you don't hand-fix any of that.

You give it a clip. It gives you frames, matched audio, the width/height/length your generation should use, and the video itself.

What it actually does

It reads your clip's original frame rate first - not to convert the clip, but to preserve playback speed. Frames are selected at 24 fps positions mapped from the source timeline, so a 30 fps clip comes out at 24 fps with the same duration rather than playing 25% too fast.

duration_seconds (0 = use the whole clip) caps how much of the clip is used, and here's the bit that surprises people: the selected duration is rounded up to a supported H3 frame count. You don't get 3.0 seconds because you asked for 3.0 seconds; you get the next length H3 will accept, which may run slightly longer and repeat the final frame at the end. Ask for 0 seconds and the whole clip goes in.

megapixels (default 0.258) controls the frames output size: it matches your clip to the nearest standard aspect ratio from this pack's video resolution selector, picks that ratio's preferred resolution for the target size, and center-crops to fit. Edges get trimmed; nothing gets stretched. And it affects only the separate frames output - the video output keeps your source resolution and framing.

The audio path is the quietly clever part. Your soundtrack is trimmed to the prepared length, resampled to 32 kHz, and zero-padded at the end to a multiple of 800 samples so Core's H3 audio input doesn't crop the beginning. A silent tail may be added, which is intentional - it's insurance, not a bug. No audio at all? You get silence of the right length rather than an error.

The outputs, and which one you want

frames is the prepared 24 fps image batch - this goes into your H3 reference-video input, and it's the one megapixels resizes.

audio is the soundtrack matched to those frames and adjusted for H3. Leave it disconnected if you don't want an audio reference.

width and height are the generation dimensions that match the frames, and length is the generation length in frames at 24 fps, including the H3 length adjustment. Wire those three into your sampler/latent-video sizing rather than typing numbers you half-remember from the model card.

video is the length-adjusted 24 fps clip with matched audio, at the source's own resolution and framing. Hand this to anything that accepts VIDEO - an editor node, a preview, another model - without inheriting the crop you took for the reference frames. That split is the node's best idea: the reference frames and the clip you show people are allowed to be different shapes.

Install

Manager → search "ComfyUI-UtilsCollection", or:

cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection
# restart ComfyUI

Nothing downloads for this node - it's arithmetic on a clip you already have. The pack's requirements.txt brings in opencv-python, huggingface_hub, unifiedefficientloader and typing-extensions; note also that the collection imports kornia when it loads without declaring it, which is the usual reason a fresh install shows no nodes at all.

Where it goes wrong

Expect the length to be longer than you asked for. That's the frame-count rounding, and if you were counting on a hard 5-second ceiling you'll want to check length instead of assuming it. It matters for generation time and VRAM just as much as resolution does.

Watch the aspect matching too: it picks the nearest standard ratio and center-crops, so a 2.35:1 film clip loses its sides to fit a 16:9 bucket. If that matters, pre-crop the clip yourself before it reaches the node.

And keep some perspective on megapixels: 0.258 MP is a modest reference frame, not an output resolution. Raising it mostly spends token budget on detail the reference doesn't need, since your generation dimensions come from width and height anyway.

Categoryadvanced/video

Inputs (4)

NameTypeDefaultDescription
videoVIDEOReference clip. Its original frame rate is used to preserve playback speed when preparing 24 fps frames.
megapixelsFLOAT0.2580.01–4Target frame size. Matches the video to the nearest standard aspect ratio from Video Resolution Selector, chooses its preferred resolution, and center-crops to fit. Edges may be trimmed; the picture is not stretched.
duration_secondsFLOAT0.0Maximum reference duration after the start offset. 0 uses the remaining clip. The selected duration rounds up to a supported H3 frame count at 24 fps, so it may run slightly longer and repeat the final frame.
start_at_timestampFLOAT0.0Seconds to skip at the start, for both video and audio. 0 skips nothing; positive values use the same H3 frame-count rounding as duration. Preview frame numbers are zero-based and the end frame is inclusive.

Outputs (6)

NameTypeDescription
framesIMAGEPrepared 24 fps frames. Connect to H3 Reference to Video's reference-video input.
audioAUDIOSoundtrack matched to the prepared video and adjusted for H3. Missing audio at the end is filled with silence; a tiny silent tail may be added to prevent Core from cutting the start. Leave disconnected if no audio reference is wanted.
widthINTMatching generation width in pixels.
heightINTMatching generation height in pixels.
lengthINTMatching generation length in frames at 24 fps, including the H3 length adjustment.
videoVIDEOLength-adjusted 24 fps video with matching audio, preserving the source resolution and framing. The megapixels setting affects only the separate frames output.