KY_FFmpeg: Trim Video (Duration)
Trim Video — cut a clip by start time and duration
- video_path
The simplest cut tool in the KY_FFmpeg* family: give it a start time and a duration, and it hands back a clip of exactly that length from that point. No frame-by-frame editing, no timeline UI - just numbers in, trimmed file out.
The speed-vs-accuracy tradeoff, spelled out by the node itself
There's exactly one meaningful decision here: copy_stream. When true (the default), the trim uses ffmpeg's stream-copy mode - no re-encoding, so it's fast and lossless - but the node's own description is upfront about the catch: "start time might be slightly off." That's the well-known keyframe-seeking limitation of stream copy - ffmpeg can only actually cut cleanly on a keyframe, so if your requested start_time_seconds doesn't land exactly on one, the real cut point shifts to the nearest keyframe instead. Turn copy_stream off and you get a full re-encode, which lands exactly on your requested time at the cost of processing time.
Inputs and output
video_in_path and output_path are file paths (not ComfyUI video objects - this whole node family works on disk paths). start_time_seconds (default 10, in 0.1-second steps) and duration_seconds (default 5, same step size) define the cut. copy_stream is the boolean described above. One output: video_path, the string path to the trimmed file.
Installing it
ComfyUI Manager: search ComfyUI-KYNode, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/yorkane/ComfyUI-KYNode
Restart ComfyUI. Needs ffmpeg installed and on PATH, same as every other node in the KY_FFmpeg* family - the pack shells out to the real ffmpeg binary rather than bundling its own, and its README doesn't spell this dependency out anywhere, so it's worth confirming ffmpeg -version works in the same environment ComfyUI runs in before relying on this node.
Common issues
If your trimmed clip's actual start is off by a fraction of a second (or occasionally more, depending on your source's keyframe interval), that's not a bug - it's exactly the tradeoff the node's own description warns about. Flip copy_stream to false for frame-accurate trimming when precision matters more than speed.
Since this node reads and writes plain file paths rather than ComfyUI's in-memory video objects, if your source video came out of a generation node upstream, make sure it's actually been saved to disk first (through a save node) - you can't wire an in-memory video tensor straight into video_in_path, it needs a real path string.
The default placeholder paths (C:/path/to/input_video.mp4) are Windows-style - nothing about the node is OS-specific, just supply your own real path with the separators appropriate to your system.
And a duration_seconds that runs past the end of the source video should just get clamped to whatever's left in the file rather than erroring, but if you're building a pipeline around exact output lengths, it's worth double-checking your source is actually long enough before assuming the requested duration was honored.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| video_in_path | STRING | C:/path/to/input_video.mp4 | — |
| output_path | STRING | C:/path/to/trimmed_video.mp4 | — |
| start_time_seconds | FLOAT | 10.0 | — |
| duration_seconds | FLOAT | 5.0 | — |
| copy_stream | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| video_path | STRING | — |