Nodes/ComfyUI_StarNodes/⭐ Star Video Loader (Low RAM)
ComfyUI Node

⭐ Star Video Loader (Low RAM)

Load only the window of frames you can actually hold

By Starnodes2024·Created 2 years ago·Updated 2 days ago· 106
⭐ Star Video Loader (Low RAM)
    • images
    • audio
    • fps
    • frames
    • total_frames
    • next_start_frame
    • info
    video
    start_frame0
    frame_count81
    force_rate0.00
    select_every_kth1
    load_audiotrue
    cache_to_diskfalse

    The regular ⭐ Star Video Loader decodes a whole video into one big tensor. That's fine for a 5-second clip and a quiet way to crash your machine on a 20-minute one. ⭐ Star Video Loader (Low RAM) takes the opposite approach: it never holds more than one window of frames in memory, so "video too big for RAM" stops being a wall you hit and becomes a loop you walk through.

    This is the node you reach for when you're doing frame-level work on real footage - upscaling, inpainting, restyling a segment - and the source file is longer than your patience for OOM errors. It's part of the StarNodes pack, the big helper collection from the r/comfyui dev who builds "for myself but maybe some of you can use them too."

    The window model

    Two inputs define your window:

    • start_frame - the first frame you want, counted after any force_rate / select_every_kth processing.
    • frame_count - how many frames to actually hold in RAM. Default is 81, and the tooltip gives you the honest math: 81 frames of 1080p is roughly 500 MB. That's the whole point - you pick what fits and never pay for the rest.

    The node seeks straight to the right timestamp with a fast ffmpeg -ss seek, decodes just that window, and hands it to you. Because it can't see the end of the file without decoding it, total_frames is an estimate in windowed mode.

    Walking the video

    This is where it gets clever. Alongside images, audio, fps, frames, total_frames, and an info string, it outputs next_start_frame - exactly the value you feed back into start_frame to grab the next chunk. Wire it up with a loop or an iterative workflow and you can chew through a whole long video a slice at a time, with each slice fitting in RAM. The audio output matches the loaded frame window (toggle with load_audio if you want to skip it for speed).

    cache_to_disk: decode once, read forever

    If you're going to hit the same file repeatedly, flip cache_to_disk on. The first run decodes the entire video to a raw frame cache in ComfyUI's temp folder (star_lowram_cache), streaming to disk so memory stays flat. Every later run - any window - reads that cache via memory-mapping instead of re-decoding. The cache is keyed on file path, mtime, size, and your fps settings, and invalidates automatically when any of those change. The trade-off: the first run is slower (it decodes everything), but repeated runs become nearly instant.

    Installing it

    ComfyUI Manager, search Starnodes, install, restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Starnodes2024/ComfyUI_StarNodes
    cd ComfyUI_StarNodes
    pip install -r requirements.txt
    

    It lives under ⭐StarNodes/Video and needs ffmpeg (the pack resolves a bundled binary, imageio-ffmpeg, or system ffmpeg).

    Common gotchas

    • start_frame past the end of the video throws an error (or returns zero frames in windowed mode) - that's your signal to stop, not a bug.
    • First run with cache_to_disk feels slow because it's building the full cache. Let it finish once and subsequent runs justify it.
    • If the console says "ffmpeg was not found", install imageio-ffmpeg or put ffmpeg on PATH.

    The Low RAM loader doesn't pretend to be fancy. It just refuses to load a video it can't hold - which is precisely why it's the one that finishes the job.

    Category⭐StarNodes/Video

    Inputs (7)

    NameTypeDefaultDescription
    videoCOMBO0 options:
    start_frameINT00–100000000First frame of the window, counted in the output frame sequence (after force_rate / every-kth). Feed next_start_frame back in here to walk through the video in chunks.
    frame_countINT811–1000000How many frames to load into memory. This is the ONLY part of the video that uses RAM - pick what fits (81 frames of 1080p is roughly 500 MB).
    force_rateFLOAT0.000–240Resample to this fps. 0 = keep the video's original frame rate.
    select_every_kthINT11–1000Keep only every k-th frame (1 = keep all). Also divides the output fps.
    load_audioBOOLEANtrueExtract the audio matching the loaded frame window.
    cache_to_diskBOOLEANfalseDecode the video ONCE into a raw frame cache inside the ComfyUI temp folder. Later runs (any window) read straight from disk without decoding again - great for repeated runs on the same long video. The cache is invalidated automatically when the file or the fps settings change.

    Outputs (7)

    NameTypeDescription
    imagesIMAGE
    audioAUDIO
    fpsFLOAT
    framesINT
    total_framesINT
    next_start_frameINT
    infoSTRING