Nodes/ComfyUI-K3NKImageGrab/Load Video Batch From Dir (K3NK)
ComfyUI Node

Load Video Batch From Dir (K3NK)

Feed Video Files Into a ComfyUI Graph Like They Were Image Batches

By K3NK3·Created 9 months ago·Updated 2 months ago· 8
Load Video Batch From Dir (K3NK)
    • images
    • masks
    • frame_count
    • video_info
    directory
    sort_method
    start_index0
    frame_load_cap0
    load_alwaysfalse

    ComfyUI is great at generating video, and surprisingly clumsy at ingesting it. There's no stock node that just opens an MP4 and hands you the frames as a tensor - you either install a big video suite or pre-extract frames with a script. Load Video Batch From Dir (K3NK) is the lightweight middle path: point it at a folder, tell it which video (by index), and it uses PyAV to decode the file into an IMAGE batch plus a VHS_VIDEOINFO dict that plays nicely with the Video Helper Suite ecosystem.

    It's one of those "small node, real gap" additions. If your workflow starts from a reference clip - style transfer, img2vid from a phone recording, re-lighting a stock shot - this is the cleanest way to get that clip into the graph.

    How it works

    Under the hood it's PyAV (av), the same decoder Video Helper Suite uses. It opens the chosen file, pulls the first video stream, reads FPS/resolution/duration metadata, and decodes frames to RGB tensors. You get four outputs:

    • images - [N, H, W, 3] float tensor, one frame per row. The thing you wire into everything.
    • masks - a matching batch of all-zero masks, same size as the frames. These are placeholders, kept so the output signature matches what VHS-style nodes expect; if you're compositing, generate your own masks.
    • frame_count - how many frames landed in the batch.
    • video_info - a dict with source_fps, source_frame_count, source_duration, resolution, and their loaded counterparts. This is the same schema VHS uses, so it plugs into nodes that consume VHS_VIDEOINFO for scheduling and combine logic.

    sort_method decides which video you get, and it's the same 7-way enum as the pack's text loader: None, Alphabetical, Numerical, or Datetime, each ASC/DESC. Numerical is the one for zero-padded sequences (clip_01.mp4 before clip_10.mp4). start_index (default 0) picks which file in the sorted list loads. frame_load_cap (default 0) limits frames extracted - 0 means everything. load_always forces a re-read every run, useful when you're dropping new videos into the folder and iterating.

    Supported extensions from the README: mp4, avi, mov, mkv, webm, flv, wmv, m4v, 3gp. It's a video loader, so no encoding happens - if you want to convert a file's codec, you want the pack's concat node or a re-encode step elsewhere.

    Installing it

    Part of the K3NK pack. ComfyUI Manager → search ComfyUI-K3NKImageGrab, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/K3NK3/ComfyUI-K3NKImageGrab
    

    Then the one dependency the README calls out explicitly: PyAV.

    pip install av
    

    That's the real requirement (the repo's requirements.txt lists opencv-python as optional, but the shipped code uses av, not OpenCV). Missing av is the #1 symptom when this node fails at load or import time.

    Where people get burned

    The frame count is the first reality check: a 30-second clip at 24 fps becomes 720 frames, which is a lot of VRAM as a float tensor - set frame_load_cap unless you actually need all of them. Second, the masks output being all zeros is intentional but easy to misread; if a downstream node dims your video to black, it's usually because you wired in those placeholder masks as if they were real. And remember it picks one video per call - for "load every clip in a folder," you're better off with the pack's Image Grab family or a loop, not this node. It's a scalpel, and it's good at being one.

    CategoryK3NK/loaders

    Inputs (5)

    NameTypeDefaultDescription
    directorySTRING
    sort_methodCOMBO7 options: None, Alphabetical (ASC), Alphabetical (DESC), Numerical (ASC), Numerical (DESC), Datetime (ASC), +1
    start_indexoptINT00–99999Índice del video a cargar
    frame_load_capoptINT0Máximo frames a extraer (0 = todos)
    load_alwaysoptBOOLEANfalse

    Outputs (4)

    NameTypeDescription
    imagesIMAGE
    masksMASK
    frame_countINT
    video_infoVHS_VIDEOINFO