ComfyUI Node

🎬 Video Frame Loader

The boring, dependable frame extractor at the start of every Kanibus workflow

By kanibusΒ·Created about a year agoΒ·Updated about a year agoΒ· 5
🎬 Video Frame Loader
    • frames
    • metadata
    • total_frames
    • actual_fps
    β—„video_pathβ–Ί
    β—„start_frame0β–Ί
    β—„frame_count-1β–Ί
    β—„step1β–Ί
    β—„target_fps-1.00β–Ί
    β—„resize_width-1β–Ί
    β—„resize_height-1β–Ί
    β—„qualityhighβ–Ί
    β—„enable_cachingtrueβ–Ί
    β—„wan_versionautoβ–Ί
    β—„optimize_for_wantrueβ–Ί
    β—„batch_size8β–Ί
    β—„preload_frames32β–Ί
    β—„color_spaceRGBβ–Ί

    Every eye-tracking video workflow needs frames before it can track anything, and that's this node's whole job. It's the least glamorous node in the kanibus/kanibus pack and also one of the most reliable - unlike several of its siblings, VideoFrameLoader genuinely does what it says. It's a solid OpenCV-backed video loader with real caching, and it's the front door for the pack's KanibusMaster and per-node tracking pipeline.

    The pack is a mixed bag (some nodes are real, some are placeholder stubs), but this one is the boring, useful kind. If you're trying to run the pack's example workflows, this is where they start: point it at a file, get frames out.

    How it works

    It opens the file with cv2.VideoCapture and extracts real metadata - resolution, FPS, frame count, duration, fourcc codec, file size - then reads frames in the range you ask for. The clever bits:

    • Caching is real. It hashes the file path + size + mtime and keeps a memory/disk cache (cache/video_frames under the repo), so re-running the same workflow on the same video doesn't re-decode. Cache hits are what make iterative eye-tracking work tolerable.
    • Frame stepping and trimming. start_frame, frame_count (-1 = all frames), and step let you sample every Nth frame - the classic way to keep long videos manageable for tracking.
    • FPS and resize control. target_fps (-1 = original) re-times the output; resize_width/resize_height (-1 = keep) scale frames with interpolation quality tied to the quality setting.
    • Color space conversion. color_space (RGB, BGR, GRAY, HSV, LAB) does the conversion for you - useful because MediaPipe-based tracking in this pack assumes BGR under the hood.

    One thing to note: the frames output is a list of IMAGE tensors (OUTPUT_IS_LIST is set for it), while metadata, total_frames and actual_fps come out alongside. That list output is what KanibusMaster's video_frames input expects.

    Inputs you'll actually touch

    • video_path - the path to your file. The only input that must be right.
    • frame_count - the "why is it taking forever" control. Set it to a real number unless you genuinely want every frame of a long clip.
    • step - the other "make it fast" control. Step 2 halves the work.
    • quality - original/high/medium/low; affects decode interpolation and cache compression. high is a good default.
    • batch_size / preload_frames - prefetch tuning; defaults of 8/32 are fine.

    Installing

    cd ComfyUI/custom_nodes
    git clone https://github.com/kanibus/kanibus
    cd kanibus    # lowercase - README's "cd Kanibus" fails on Linux/Mac
    pip install -r requirements.txt   # requirements_minimal.txt if the full set clashes
    python install.py
    

    Restart ComfyUI, look under Kanibus/Input. No model downloads needed - this node is pure OpenCV. (Ignore the README's "you MUST download 5.6GB of ControlNet models" - no node in the pack actually loads those.)

    Gotchas

    • Path errors. A wrong video_path raises a FileNotFoundError / "Could not open video file" - check your path, and note it's a filesystem path, not a ComfyUI input-relative path.
    • Absolute paths only, effectively. There's no browse button here, which is a real usability gap compared to other video loaders.
    • Stateful capture pool. It keeps VideoCapture objects cached per filepath; changing files can leave stale handles until restart. Restarting ComfyUI is the reliable reset.
    • frame_count = -1 means everything. If you pass a 10-minute 4K file with no limit, you asked for that decode time. Use start_frame/frame_count/step deliberately.

    If you just want frames out of a video to feed the pack's real tracking nodes, this is the node to reach for. If you'd rather not install a pack that's half placeholders, any solid video-frame loader (there are several standalone ones) does the same job - but this one works, caches well, and plugs straight into the pack's VIDEO_METADATA plumbing.

    CategoryKanibus/Input

    Inputs (14)

    NameTypeDefaultDescription
    video_pathSTRINGβ€”
    start_frameINT00–999999β€”
    frame_countINT-1-1–999999β€”
    stepINT11–100β€”
    target_fpsoptFLOAT-1.00-1–120β€”
    resize_widthoptINT-1-1–4096β€”
    resize_heightoptINT-1-1–4096β€”
    qualityoptCOMBOhigh4 options: original, high, medium, low
    enable_cachingoptBOOLEANtrueβ€”
    wan_versionoptCOMBOauto3 options: auto, wan_2.1, wan_2.2
    optimize_for_wanoptBOOLEANtrueβ€”
    batch_sizeoptINT81–64β€”
    preload_framesoptINT320–256β€”
    color_spaceoptCOMBORGB5 options: RGB, BGR, GRAY, HSV, LAB

    Outputs (4)

    NameTypeDescription
    framesIMAGEβ€”
    metadataVIDEO_METADATAβ€”
    total_framesINTβ€”
    actual_fpsFLOATβ€”