Nodes/IAMCCS-nodes/WanMotionProTrimmer (trim overshoot tail)
ComfyUI Node

WanMotionProTrimmer (trim overshoot tail)

The scissors for overshoot frames

By IAMCCS·Created 11 months ago·Updated 7 days ago· 113
WanMotionProTrimmer (trim overshoot tail)
  • latent_in
  • latent
  • video_frames
trim_slots0

When you set end_overshoot_slots on WanImageMotionPro, you're telling the node to generate more frames than you actually want - the extra tail exists so the end frame can converge without hard-freezing, and then you're supposed to cut it off. WanMotionProTrimmer is that cut. It's a two-input node that exists to make the overshoot workflow clean instead of fiddly.

What it does

Inputs:

  • latent_in - the sampled latent coming out of your KSampler.
  • trim_slots - how many latent slots to remove from the tail. The intended wiring is straight from WanImageMotionPro's trim_slots output into here. 0 = pass-through, no modification.

Outputs:

  • latent - the trimmed latent, ready for VAE decode or as prev_samples for the next segment.
  • video_frames - the frame count of the trimmed result, computed as (T-1)*4 + 1 (Wan's 4-frames-per-latent-slot conversion). Handy for feeding a video combine node or checking your math.

How it works

It slices the tensor along the temporal axis (samples[:, :, :T_out]) - no interpolation, no blending, just a clean cut. At trim_slots = 0 it's a transparent pass-through that doesn't even copy the tensor, so you can leave it in the graph permanently without paying for it. The only subtlety is the frame math: cutting one latent slot removes the last ~4 video frames, so if you overshot by 4 frames you trim exactly 1 slot.

Why the overshoot dance at all

The end-lock on the motion node pins the last frame inside the generated window. If the visible clip ends exactly on the locked frame, the model has to "freeze" onto it - that's the static/ping-pong end you see in naive FLF. Overshoot pushes the lock past the visible range, so the visible portion converges toward the end frame while staying alive, and the trimmer removes the convergence tail afterward. The pair is the difference between an ending that snaps and an ending that settles.

Installing it

Part of IAMCCS-nodes. ComfyUI Manager (search "IAMCCS") or:

cd ComfyUI/custom_nodes
git clone https://github.com/IAMCCS/IAMCCS-nodes.git

Restart after. No model files, no dependencies.

Common issues

The one mistake that catches people: trimming when overshoot wasn't used. If trim_slots is fed from a segment that ran with end_overshoot_slots = 0, the output is 0 anyway (the motion node reports 0), so it's a no-op - but if you hand-tune trim_slots to a positive number on a non-overshoot segment, you'll silently chop real frames off your clip. Wire it from the motion node's output and don't touch it. Also note the same KJNodes caveat that applies upstream: the crash with FETA/wrapped_attention happens at overshoot time on the motion node, not here - the trimmer is the innocent party in that drama.

CategoryIAMCCS/Wan

Inputs (2)

NameTypeDefaultDescription
latent_inLATENT
trim_slotsINT00–64Number of latent slots to remove from the tail of latent_in. Wire directly from the trim_slots output of WanImageMotionPro. 0 = pass-through, no modification.

Outputs (2)

NameTypeDescription
latentLATENT
video_framesINT