Nodes/ComfyUI_AITECCAFE_Toolkit/🎞️ AITEC Media Loader
ComfyUI Node

🎞️ AITEC Media Loader

A folder loader that handles images AND videos — with frame control

By AI-TEC·Created about a year ago·Updated about a month ago· 4
🎞️ AITEC Media Loader
    • image
    • mask
    • filename
    • total_frames
    • fps
    folder_pathD:/ComfyUI/input
    seed0
    include_subfoldersfalse
    frame_index0
    load_all_framestrue
    max_frames1000
    frame_step1

    AITEC Media Loader is the Image Loader's bigger sibling: same folder-stepping by seed, but it also decodes videos into frame batches. If you've got a folder of .mp4 clips you want to run through an img2img pass, a frame-by-frame NSFW sweep, or an interpolation workflow, this is the node that turns them into IMAGE tensors without leaving ComfyUI.

    The file selection works exactly like the Image Loader: it lists every image (.jpg/.jpeg/.png/.bmp/.tiff/.webp) and video (.mp4/.avi/.mov/.mkv/.wmv/.flv/.webm) in the folder, sorts by name, and uses seed % len(files) as the index. Bump the seed to advance to the next file in filename order. include_subfolders recurses with os.walk when you need it.

    Then the video controls kick in:

    • load_all_frames - on (default) decodes the whole clip into a batch; off grabs a single frame.
    • frame_index - which frame to grab when load_all_frames is off (wraps around the video length).
    • max_frames - caps the batch at N frames (default 1000). A 10-minute 30fps clip won't blow your VRAM because this stops it at 1000 frames.
    • frame_step - only keep every Nth frame (default 1 = all of them). This is your cheap downsampler: step 2 halves the batch size.

    Outputs are the richest in the pack: image (the frame batch), mask (a luminance map per frame - not an alpha mask, same caveat as the Image Loader), filename (the relative path), total_frames (the video's actual frame count), and fps. Those last two are why this node earns its keep: you can carry fps forward to a video-merge or interpolation node and reconstruct timing correctly, instead of guessing. For a still image, total_frames comes back as 1 and fps as 1.

    A couple of practical notes. Frame extraction goes through OpenCV's VideoCapture, so codec support is whatever your OpenCV build has - a clip that won't open will raise "Could not open video file" with the path in the message. And note the seed auto-increments each run (hidden seed+1 return), same as the Image Loader - so queuing the workflow walks the folder automatically, which is the intended batch pattern.

    Installation is the pack-wide path; this node is the reason opencv-python is in the requirements:

    cd ComfyUI/custom_nodes
    git clone https://github.com/AI-TEC/ComfyUI-AITECCAFE-Toolkit
    pip install -r ComfyUI-AITECCAFE-Toolkit/requirements.txt
    

    or search "AITECCAFE" in ComfyUI Manager. The tensorflow and opennsfw2 in that file are for the moderation nodes, not this one.

    Where this stands in the ecosystem: it's a no-frills frame loader, not a smart video tool - no trim points, no scene detection, no audio. But for "give me frames from every clip in this folder, in order," it's hard to beat for simplicity, and the fps/total_frames outputs plug the gap that a bare Load Images node leaves behind.

    CategoryAITECCAFE-Toolkit

    Inputs (7)

    NameTypeDefaultDescription
    folder_pathSTRINGD:/ComfyUI/input
    seedINT00–18446744073709550000
    include_subfoldersBOOLEANfalse
    frame_indexINT00–9999
    load_all_framesBOOLEANtrue
    max_framesINT10001–9999
    frame_stepINT11–10

    Outputs (5)

    NameTypeDescription
    imageIMAGE
    maskMASK
    filenameSTRING
    total_framesINT
    fpsFLOAT