Video Get Frames Range
Grab a slice of a long video without melting your RAM
- video
- images
The name undersells this one. VideoGetFramesRange is the node that lets you pull a specific slice of frames out of a long video without the whole file ending up in VRAM or RAM - which is the exact thing that makes stock ComfyUI choke on anything longer than a few seconds of 4K.
Here's the background you need. ComfyUI's built-in video loader decodes every frame into a single tensor up front. That's fine for a 3-second clip you generated yourself; it's a memory bomb for a 20-minute file. The README for this pack puts the number at 50+ GB for long 4K videos before you even get to do anything with the pixels. This node sidesteps that by using PyAV to decode only the frames you asked for - frame-by-frame, lazily - so the source video never gets fully materialized. The output tensor is only as big as the slice you requested.
What it does
Feed it a video (the VIDEO type, from the pack's own Video Load Preview node), tell it where to start and stop, and you get an images (IMAGE) batch back.
start_frame- where to begin, 0-indexed. Frame 0 is the first frame of the file.end_frame- where to stop, inclusive. The trick here is that-1means "last frame," sostart=0, end=-1returns the whole video as one tensor (no, that doesn't magically make the OOM go away - the output still has to fit in memory).- Output:
images(IMAGE) - a normal image batch, which means you can wire it into anything that eats IMAGE: a frame-by-frame processing loop, an upscaler, VAE encode into a video pipeline, or just Save Image to dump a range of frames as a PNG sequence.
Why you'd actually use it
A few real patterns. You want to inspect or edit only a section of a clip - grab frames 1200–1260, run them through whatever, and skip the other three thousand. You're doing a face-detail pass on a shot and only care about the segment where the subject is on screen. Or you're building a video-editing workflow where you extract a chunk, process it, then stitch it back. Since the decode is lazy, asking for 60 frames out of a 10,000-frame source costs you roughly the same as a 60-frame clip would.
Common issues
- "End frame must be >= start frame." If
end_framelands belowstart_frameyou get a hard error. Setend_frameto-1when you just want "to the end" rather than guessing a number. - "Start frame out of range." Asking for frame 9000 of an 8000-frame video throws. Wire
VideoGetTotalFrames(same pack) into the mix if you're computing indices dynamically. - Big ranges still cost memory. Lazy decoding is not lazy storage - request 1000 frames and you get a 1000-frame tensor. Don't use this node as a way to load a whole long video into the graph; that's exactly the OOM you were trying to avoid. Extract the slice you need, not the whole reel.
- The
videoinput expects the VIDEO type. A bare file path won't connect. Load through Video Load Preview and you're set.
Install
cd ComfyUI/custom_nodes/
git clone https://github.com/guchendesigndog/comfyui-video-edit.git
pip install -r comfyui-video-edit/requirements.txt
or search "ComfyUI-Video-Edit" in ComfyUI Manager, then restart ComfyUI. The only real dependency is PyAV (av>=10.0.0), which needs FFmpeg present on your system - on Windows the README points you at conda install -c conda-forge av or pip install av. The VIDEO type and this pack's preview nodes need a current ComfyUI, so if the nodes don't appear, update ComfyUI before you go digging for missing packages. It's a small, low-key pack - don't expect a big community footprint around it, but the code is MIT-licensed and the lazy-decode trick is genuinely solid.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| video | VIDEO | — | |
| start_frame | INT | 00–99999 | — |
| end_frame | INT | -1-1–99999 | -1 means last frame |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |