Nodes/Enigmatic Nodes/Load & Trim Video
ComfyUI Node

Load & Trim Video

Cut a clip and feed it straight into video gen

By enigmatice·Created 2 months ago·Updated 7 days ago· 1
Load & Trim Video
    • images
    • video
    • audio
    • frame_count
    • fps
    • width
    • height
    video
    start_time0.000
    end_time0.000
    longest_side1280
    select_every_nth1
    frame_load_cap0
    extract_audiotrue

    Every image-to-video workflow starts the same way: a source clip you need at the right length, the right resolution, and sometimes at a fraction of the frame rate. Load & Trim Video does all of that in one node, with a live frame preview and a scrub timeline drawn right on it - drag the brackets, press play, and out comes the trimmed range as an IMAGE batch, a native VIDEO, the matching AUDIO, and a pile of metadata. No pre-cutting in DaVinci, no manual resize math.

    It's part of Enigmatic Nodes, a small utility pack by the individual dev enigmatice. Like its sibling Load & Trim Audio, it's pure local Python plus a JS frontend - no models, no keys, no downloads.

    How it works

    The decode uses PyAV (the same library ComfyUI core uses), and it's smarter about it than most loader nodes: it seeks near the start time instead of decoding from frame zero, so a long source doesn't waste time chewing through the whole file just to get to your trim point. Frames are resized with LANCZOS so the longer edge matches your longest_side and the other edge is derived from the source's own aspect ratio - a 16:9 clip at 1280 becomes 720, a 1:1 clip at 720 stays 720. Everything is rounded to an even number, which keeps most downstream pipelines happy.

    Two details are worth knowing before you touch the settings. select_every_nth doesn't just drop frames and leave you with a choppy, faster clip - it divides the output fps by the same factor, so a 30fps clip kept every 2nd frame comes out as 15fps and plays for the same real-time length. That's the behavior you actually want for thinning, and it's easy to miss. And the VIDEO output is a native ComfyUI VIDEO object, built through the newer comfy_api backend, so it plugs straight into nodes that expect VIDEO rather than making you manually convert frames.

    The inputs that matter

    • video - a file from ComfyUI's input folder, with an Upload button or drag-and-drop onto the node.
    • start_time / end_time - trim bounds in seconds; 0 end means "to the end".
    • longest_side (default 1280) - the size of the longer edge; the other is computed from the source aspect ratio. 0 keeps the original size.
    • select_every_nth (default 1) and frame_load_cap (default 0) - thin the output and guard against loading a massive clip at full rate.

    There's also extract_audio (default on), which trims the video's audio track to the same range - or returns silence if you turn it off to skip audio decoding.

    The outputs

    images (the frames as IMAGE), video (native VIDEO), audio (AUDIO), and frame_count, fps, width, height - the metadata that typically feeds the next node's settings or a filename.

    Installing it

    Same for the whole pack:

    • ComfyUI Manager - search Enigmatic Nodes, install, restart.
    • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/enigmatice/comfyui-enigmatic-nodes, then restart.

    No models to download. The pack declares torch, numpy, scipy, Pillow, opencv-python; ComfyUI core already ships all but opencv-python, and Manager installs deps automatically. One real requirement: because the VIDEO output uses the newer comfy_api backend, you want a fairly recent ComfyUI - if you're months behind on updates, update before complaining the node fails.

    Common issues

    • "No frames decoded in the selected range" - your trim start/end lands outside the actual clip. Nudge the brackets back inside.
    • The VIDEO output errors on an old install - update ComfyUI; the node targets the modern backend.
    • Frame count surprises - select_every_nth changes the fps output, not just the count, so don't be confused when fps reads 15 on a 30fps source.

    It's a young node from a pack with essentially zero community presence yet, so the debugging will be on you. The good news is it's one of those rare utility nodes that solves the whole "prepare a clip for video gen" step in a single drag - worth having even if it's the only node you use from the pack.

    Categoryenigmatic

    Inputs (7)

    NameTypeDefaultDescription
    videoCOMBOPick a video from ComfyUI's input folder, or use the Upload button on the preview.
    start_timeFLOAT0.0000–86400Trim start in seconds. Drag the left bracket on the timeline.
    end_timeFLOAT0.0000–86400Trim end in seconds. 0 (or past the clip length) means play to the end. Drag the right bracket on the timeline.
    longest_sideINT12800–8192Target size of the LONGER edge. The other edge is computed from the video's own aspect ratio (16:9 @ 1280 -> 720, 1:1 @ 720 -> 720). Enter 0 to keep the original size.
    select_every_nthINT11–1000Keep only every Nth frame within the trim (1 = every frame).
    frame_load_capINT00–100000Maximum number of frames to output (0 = no limit). Guards against loading a huge clip at full frame rate.
    extract_audioBOOLEANtrueAlso output the video's audio track, trimmed to the same range. Turn off to skip audio decoding (silence is returned).

    Outputs (7)

    NameTypeDescription
    imagesIMAGE
    videoVIDEO
    audioAUDIO
    frame_countINT
    fpsFLOAT
    widthINT
    heightINT