Nodes/ComfyUI-Simple-Iterator/Iterator Load Video Path
ComfyUI Node

Iterator Load Video Path

Batch video-to-video without touching the path box

By yangzhuangqiu·Created 5 months ago·Updated 5 months ago· 0
Iterator Load Video Path
    • VIDEO_PATH
    • FILE_NAME
    • INDEX
    • TOTAL
    directory
    pattern*.mp4
    recursivefalse
    ordername_asc
    loop_modestop
    resetfalse
    load_alwaysfalse
    enable_logfalse
    filename_with_exttrue

    Unlike its siblings in the pack, IteratorLoadVideoPath doesn't load anything. It scans a directory for video files and hands you a path - a plain string - one per run. That's deliberately dumb, and it's the point: the actual decoding happens downstream in a video loader node, so this stays cheap and your workflow decides how to open the file.

    How it works

    Same persistent-cursor machinery as the rest of ComfyUI-Simple-Iterator. The directory is scanned on each run, hits are sorted by order, and one entry is emitted per execution with the cursor parked in .iterator_state.json in the plugin folder, keyed by node id plus directory plus pattern. Because the output is just a string, there's no heavy decode inside the node - check the pack's requirements and you'll find numpy and Pillow, no PyAV, no ffmpeg bindings. torch comes from your ComfyUI install itself.

    Supported extensions: .mp4/.mov/.mkv/.avi/.webm/.m4v/.mpg/.mpeg/.wmv/.flv - but note the default pattern is just *.mp4. Mixed footage? Set the pattern to something like *.mp4,*.mov,*.mkv.

    The inputs that matter

    • directory - where the videos live.
    • pattern - default *.mp4, comma/semicolon separated.
    • order - name_asc/name_desc/mtime_asc/mtime_desc. mtime_desc is the one for "newest clip first" review loops.
    • loop_mode / reset - pack-wide: stop (default) raises when you run out, loop wraps, hold_last repeats the last item; reset only rewinds on a False→True edge.
    • load_always - force the node to re-execute every run even when ComfyUI thinks nothing changed.
    • filename_with_ext - whether FILE_NAME keeps the extension. Default True.

    Outputs: VIDEO_PATH (full path string), FILE_NAME (with or without extension), INDEX (0-based), TOTAL. Wire VIDEO_PATH into the path input of your video loader - the VideoHelperSuite-style nodes that take a path and do the ffmpeg work are the natural pairing - or into a text display node to see which clip is current.

    Installing it

    Pack-wide install - ComfyUI Manager, search "ComfyUI-Simple-Iterator", or clone:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yangzhuangqiu/ComfyUI-Simple-Iterator
    

    Restart ComfyUI after. Dependencies are just numpy and Pillow; nothing heavy downloads.

    Where people get confused

    The node shows no preview because there's nothing to preview - it's a path, not a video. If nothing changes on screen, check that your loader is actually consuming the string. The usual iterator traps apply too: an empty directory with stop raises "Iterator exhausted", and if you keep getting the same clip, look at load_always and whether the downstream loader is caching its output.

    Categorysimple_iterator

    Inputs (9)

    NameTypeDefaultDescription
    directorySTRING
    patternSTRING*.mp4
    recursiveBOOLEANfalse
    orderCOMBOname_asc4 options: name_asc, name_desc, mtime_asc, mtime_desc
    loop_modeCOMBOstop3 options: loop, stop, hold_last
    resetBOOLEANfalse
    load_alwaysoptBOOLEANfalse
    enable_logoptBOOLEANfalse
    filename_with_extoptBOOLEANtrue

    Outputs (4)

    NameTypeDescription
    VIDEO_PATHSTRING
    FILE_NAMESTRING
    INDEXINT
    TOTALINT