Nodes/comfyui-dreambait-nodes/Load Media (img, vid or dir)
ComfyUI Node

Load Media (img, vid or dir)

One loader for images, video, folders, archives and URLs

By drmbt·Created 2 years ago·Updated 7 months ago· 6
Load Media (img, vid or dir)
    • image
    • mask
    • WIDTH
    • HEIGHT
    • COUNT
    • FILE_NAME
    • FILE_PATH
    • PARENT_DIRECTORY
    • FPS
    • AUDIO
    • PROMPT
    • METADATA_RAW
    path
    resize_images_to_firsttrue
    image_load_cap0
    start_index0
    start_index_use_seedfalse
    seed0
    error_after_last_framefalse
    skip_n0
    sortNone
    reverse_orderfalse
    loop_first_framefalse
    force_rate0

    Load Media is the pack's flagship loader, and the reason it exists is written in its own source: it "steals from all the major image loader nodes." Point it at a file, a folder, a video, a zip/tar/7z archive, a URL, or even a wildcard pattern like *.png, and it loads whatever's there as a clean image sequence - with metadata, timing, and sorting options most loaders don't bother with. If you do frame-based work (video, animation, batch processing), this replaces half your loader collection.

    What it takes in

    The path input is the whole show - an image, a directory, a video file, an archive, a URL, or a glob. The rest are sequence controls:

    • sort - None, alphabetical, date_created, date_modified, visual_path, or random. The interesting one is visual_path: it orders frames by visual similarity using a traveling-salesman-style solver (borrowed from the community's sort_visual_path work), which is a game-changer for sequences whose filenames lie about their order.
    • start_index, skip_n, image_load_cap - slice the sequence any way you want.
    • start_index_use_seed + seed - use the seed as the starting frame for random/sequential runs (great for reproducible "which frame did I start on" workflows).
    • loop_first_frame - appends the first frame to the end for seamless loops.
    • error_after_last_frame - raise instead of wrapping around with modulo when you overshoot.
    • resize_images_to_first - force every image to the first frame's dimensions (batch-friendly, and it's on by default).

    Outputs are the full spread: image, mask, WIDTH, HEIGHT, COUNT, FILE_NAME, FILE_PATH, PARENT_DIRECTORY, FPS, AUDIO, PROMPT, and METADATA_RAW. The FPS + AUDIO pair is what makes video work flow - you can hand both to a video-combine node and keep timing and sound without a second loader.

    Video, archives, URLs

    For video it detects ffmpeg and extracts frames (duration and rate come back as FPS and the audio track as AUDIO). Archives (zip/tar/7z) get unpacked into a temp dir and treated as an image sequence - handy for batch-downloaded datasets. URLs are fetched over HTTP. The one honest caveat: this is a big node with a big requirements.txt behind it (moviepy, py7zr, librosa, opencv…), so if you only need a plain image loader it's overkill. It earns its place when you're juggling mixed media - the "one loader for everything" promise is real, and it's the node people keep in their video workflows for exactly that reason.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/drmbt/comfyui-dreambait-nodes
    

    then restart ComfyUI (or ComfyUI Manager, search "comfyui-dreambait-nodes"). First run with a video needs ffmpeg available on PATH; if frame extraction silently fails, that's the first thing to check. It's a heavy install for a loader, but for animation and video work it's one of the better "just load the media" nodes around.

    Categoryimage

    Inputs (12)

    NameTypeDefaultDescription
    pathSTRINGPath to media file(s). Can be an image, directory of images, video file, zip/tar archive, URL, or wildcard pattern for images (e.g. *.png).
    resize_images_to_firstBOOLEANtrueResize all images to match the dimensions of the first image in the sequence.
    image_load_capINT0Maximum number of images to load. 0 means load all images.
    start_indexINT0Index of the first image to load from the sequence.
    start_index_use_seedBOOLEANfalseUse the seed value as the start_index for random or sequential operations.
    seedINT0Seed value for random operations and optionally start_index if start_index_use_seed is enabled.
    error_after_last_frameBOOLEANfalseIf True, raise an error when start_index exceeds frame count. If False, wrap around using modulo.
    skip_nINT0Skip N frames between each loaded frame. 0 means load consecutive frames.
    sortCOMBONoneMethod to sort multiple images: None, alphabetical, by date, visual similarity, or random.
    reverse_orderBOOLEANfalseReverse the order of loaded images after sorting.
    loop_first_frameBOOLEANfalseAppend the first frame to the end of the sequence to create seamless loops.
    force_rateFLOAT00–60

    Outputs (12)

    NameTypeDescription
    imageIMAGE
    maskMASK
    WIDTHINT
    HEIGHTINT
    COUNTINT
    FILE_NAMESTRING
    FILE_PATHSTRING
    PARENT_DIRECTORYSTRING
    FPSFLOAT
    AUDIOAUDIO
    PROMPTSTRING
    METADATA_RAWMETADATA_RAW