Nodes/ComfyUI-Minimax-H3-Reference-Library/SKEBA H3 Motion Context Trim
ComfyUI Node

SKEBA H3 Motion Context Trim

Cut the pinned frames off the front of a chained clip — picture and sound together

By nikaskeba·Created 13 days ago·Updated a day ago· 2
SKEBA H3 Motion Context Trim
  • images
  • audio
  • images
  • audio
trim_frames0
fps24.000
match_tailtrue
bypassfalse

When SKEBA H3 Motion Context pins the previous clip's frames into a new generation, those frames come back at the start of the delivered clip - the model rendered them, but you don't want them in the final video. SKEBA H3 Motion Context Trim is the knife: it removes the leading pinned frames and trims the audio by the same duration, so picture and sound stay locked together across the join.

It's part of the ComfyUI-H3-Reference-Library pack (a.k.a. ComfyUI-Minimax-H3-Reference-Library), under Skeba AI Nodes - Motion Context.

How it works

The one number you must wire in is trim_frames - connect it straight from Motion Context's trim_frames output, which reports how many frames that node actually pinned. Trim then slices that many frames off the front of the decoded images and, if audio is wired, trims the audio by the matching duration.

The rest of the inputs are settings you'll mostly leave alone:

  • fps (default 24) - the frame rate used to convert the frame count into an audio duration. It must match what you feed Create Video; get it wrong and the audio drift comes back.
  • match_tail (default on) - truncates the audio so its duration equals frames / fps exactly. This matters more than it sounds: H3 rounds its audio grid up, so every clip carries about 8ms more sound than picture, and that error accumulates at every join in a chain. On a ten-clip chain that's a visible slip by the end. Leave it on.
  • bypass - returns images and audio unchanged, for the first clip of a chain when Motion Context is disabled. Drive it from the same boolean as Motion Context and Load Latent.

Outputs are images and audio, both trimmed and ready for Combine Video Clips or Create Video.

Why you'd reach for it

This is the mandatory cleanup step in the latent chain workflow:

sampler -> Save Latent
decode  -> H3 Motion Context Trim (trim_frames wired from Motion Context)
        -> Create Video / Combine Video Clips

Without it, your second clip opens with a double-exposure of the previous clip's ending, then hard-cuts into the new material. With it, the join is seamless - and because Trim cuts picture and sound together, you don't hand-audit sync at every link.

Installing it

ComfyUI Manager - search "Skeba" or "H3-Reference-Library" - or:

cd ComfyUI/custom_nodes
git clone https://github.com/nikaskeba/ComfyUI-H3-Reference-Library

Restart ComfyUI. No extra dependencies, no model files.

Where people get burned

  • Forgetting to wire trim_frames. If you leave it at 0, nothing gets trimmed and the pinned frames ship in your video. The node can't know what Motion Context pinned unless you connect the wire - that's the entire contract.
  • Wrong fps. match_tail converts frames to audio using your fps value. Set 30 in Trim but feed 24 to Create Video and the audio lands short or long by exactly that ratio. The README is insistent for a reason: make them match.
  • It expects decoded clips. Trim works on decoded IMAGE/AUDIO, after the VAE decode - not on latents. It's the partner to Motion Context's latent path, not a replacement for the decode step.
  • Silent clips are fine, mismatched ones aren't. Leave audio unwired for silent work; if you wire it, H3's ~8ms-per-clip grid error is exactly what match_tail exists to cancel. Turning it off to "keep all the sound" is how chains drift.
CategorySkeba AI Nodes - Motion Context

Inputs (6)

NameTypeDefaultDescription
imagesIMAGE
trim_framesINT00–4096
audiooptAUDIODecoded audio for the same clip. Trimmed by the matching duration so sound stays locked to picture. Leave unwired for silent clips.
fpsoptFLOAT24.0001–240Frame rate used to convert the trim into an audio duration. Must match what you feed Create Video.
match_tailoptBOOLEANtrueTruncate the audio so its duration equals frames/fps exactly. H3 rounds its audio grid up, so each clip carries about 8ms of extra sound that accumulates at every join in a chain.
bypassoptBOOLEANfalseReturn images and audio unchanged. Turn this on for the first clip, then off when Motion Context is enabled.

Outputs (2)

NameTypeDescription
imagesIMAGE
audioAUDIO