Nodes/h4_Live/h4 - DataStream
ComfyUI Node

h4 - DataStream

Stream a whole folder of images through a workflow, one at a time

By m3rr·Created 9 months ago·Updated 10 days ago· 1
h4 - DataStream
    • image
    • filename
    • current_index
    • total_count
    • is_last
    â—„folder_pathâ–ş
    â—„current_index0â–ş
    â—„auto_queue_remainingfalseâ–ş

    H4_DataStream is the batch loader that ComfyUI never quite gave you. The built-in Load Image only reads from ComfyUI's input/ folder and you swap files by hand. DataStream loads images from any absolute path on your drive, walks the folder in order, and - here's the kicker - can auto-queue so it keeps processing until it hits the last image. Set the index to 0, flip on auto_queue_remaining, hit Queue once, and it chews through the whole folder like a conveyor belt.

    This is the node for the three jobs people keep rebuilding by hand: batch-processing a folder of reference images, running every frame of a dataset through the same img2img or detail pass, and testing against a folder of outputs to see how a setting behaves across many inputs. It's the "process this directory" button for your workflow.

    The inputs that matter

    • folder_path - the full absolute path (e.g. C:\MyPhotos). There's also a Browse button in the UI that opens a folder picker, which saves you from typos.
    • current_index - which image you're on (0 = first). It auto-increments between runs, so the state lives in the node.
    • auto_queue_remaining - the magic switch. On, and the node keeps the queue fed until the folder is done. Off, and you click manually each time.

    The outputs

    Five, and they're designed for a loop:

    • image - the current image tensor.
    • filename - the current file's name, so you can feed it to a save node for clean output names.
    • current_index - the loop counter, handy for driving other state.
    • total_count - how many files are in the folder, so you can build an "am I done yet?" check.
    • is_last - a boolean that flips true on the final image. This is the one you use to stop downstream processing or trigger a save at the end.

    What else it does

    The code also handles video: point folder_path at an .mp4, .mov, .gif, or similar and it treats it as a frame stream rather than erroring out. So if your "folder" is actually a video clip you want to process frame-by-frame, DataStream has you covered.

    Installing

    Standard h4_Live install: ComfyUI Manager → search "h4_Live", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/m3rr/h4_Live
    

    restart. Pure Python, no extra deps, no model downloads.

    Where people get burned

    The two classic traps. First, the path: if the folder doesn't exist, the node raises a clear Path not found error - but watch out for accidentally including surrounding quotes (it strips those, so it's forgiving, but a stray space still breaks it). Second, the auto-queue: it's genuinely automatic, so if you point it at a folder you don't mean to process, you get a long, unrequested batch. Start with auto_queue_remaining off and a single manual queue to confirm the folder order and paths before letting it run wild. And a pack-level note: h4_Live is a one-person project still under active development, so don't be surprised if the batch tooling evolves between versions.

    Categoryh4_Live/IO

    Inputs (3)

    NameTypeDefaultDescription
    folder_pathSTRINGPaste the full path to your folder here (e.g. C:\MyPhotos). Or use the Browse button if available.
    current_indexINT00–99999Which image number are we on? (0 = First Image). Auto-increments.
    auto_queue_remainingBOOLEANfalseIf ON, I will automatically keep processing the rest of the folder for you.

    Outputs (5)

    NameTypeDescription
    imageIMAGE—
    filenameSTRING—
    current_indexINT—
    total_countINT—
    is_lastBOOLEAN—