Nodes/ComfyUI/Trim Video
ComfyUI Node Runs on cloud

Trim Video

Cut the dead intro and outro before you pay to process it

By Comfy-Org·Created 4 years ago·Updated 20 days ago· 121,575
Trim Video
  • video
  • VIDEO
start_time0.000
duration0.000
strict_durationfalse

Trim Video (class name Video Slice, and it's been known by both) cuts a VIDEO down to a start time and a duration. It landed in ComfyUI core in February 2026, and if you've ever loaded a two-minute clip when all you wanted was the five-second middle, you already know why it exists: video processing costs scale with frames, so trimming before you demux is free speed and free VRAM.

The workflow reason to reach for it is simple. The typical chain is LoadVideoTrim VideoGetVideoComponents, and trimming first means GetVideoComponents only decodes the window you asked for instead of the whole file. There's no point decoding the 30 seconds of static intro on your reference clip just to feed three seconds of motion into img2vid.

How it works

The clever bit: trimming is lazy. The node doesn't re-encode anything or write an intermediate file - it just remembers the new start and duration on the VIDEO handle, and the actual cut happens when something later decodes it. That's why it's so cheap, and why it composes: two Trim Video nodes in a row just add their start times. It's also why the framecount in the preview doesn't always match what you'll get downstream - the real decode happens at GetVideoComponents or SaveVideo.

The inputs that matter

  • video - what you're trimming.
  • start_time - seconds, in float. Zero means the beginning. Here's the trick: a negative value counts back from the end, so -3 grabs the last three seconds of the clip. Great for pulling the tail of a loop.
  • duration - seconds, or 0 for "everything from the start point to the end of the clip."
  • strict_duration - the one that bites people. If the requested duration isn't achievable, False (the default) just silently hands you the shorter clip that does exist. True raises an error instead.

The gotcha that trips everyone

That default strict_duration = False is a footgun in disguise. Ask for 30 seconds out of a 20-second video and you get 20 seconds, no complaint. Usually that's what you want - but if a downstream node is tuned for a specific clip length, a too-short trim silently shortens your output and you'll be chasing the wrong variable. Turn strict on when the length actually matters. When it does error, the message is actually useful: it tells you the source duration, the start time, and the target duration so you can see exactly how far off you were. And one more note: duration is in seconds of playback, not frames - if you're thinking in frames, divide by the fps you know from GetVideoComponents. It ships with ComfyUI core, so it's in the video category on any current install, no extensions needed.

Categoryvideo

Inputs (4)

NameTypeDefaultDescription
videoVIDEO
start_timeFLOAT0.000-100000–100000Start time in seconds
durationFLOAT0.000Duration in seconds, or 0 for unlimited duration
strict_durationBOOLEANfalseIf True, when the specified duration is not possible, an error will be raised.

Outputs (1)

NameTypeDescription
VIDEOVIDEO