ComfyUI Node

Media List

Turn a folder of clips into a tagging queue

By civen-cn·Created about a year ago·Updated about a year ago· 1
Media List
    • media_path
    • txt_path
    • absolute_directory
    • file_count
    directory
    file_typesvideo

    Most ComfyUI nodes do clever things with latents and attention. Media List does none of that. You give it a directory, it reads the folder, and it hands you back a queue of absolute file paths - the exact step everyone hand-rolls before batch tagging a pile of footage. It's the front door of the ComfyUI-VideoTagger pack: point it at your videos (or images) and you get the worklist you were about to write a Python script for.

    How it works

    Under the hood it's plain os.listdir, no recursion. It walks the top level of the folder, matches files against an extension allowlist, and for every match emits two paths. The video set is .mp4, .avi, .mov, .mkv, .webm; the image set is .jpg, .jpeg, .png, .webp, .bmp. The second path is the sibling .txt with the same basename - the file where that clip's tags are expected to live. Note it doesn't create those text files; it just computes the paths for you. And if the directory doesn't exist, it raises a clear error instead of silently returning nothing.

    The inputs and outputs that matter

    Only two inputs, and you set both:

    • directory - paste an absolute path to your footage folder.
    • file_types - a dropdown: video or image. Pick one; there's no "both".

    The outputs:

    • media_path (STRING, list) - absolute path of every matching file.
    • txt_path (STRING, list) - the matching base_name.txt path for each.
    • absolute_directory - the directory you gave it, echoed back (handy if you converted the path to a widget and want a stable copy).
    • file_count (INT) - how many files matched, so you can sanity-check before looping.

    The gotchas

    Three things trip people up. First, it is not recursive - files in subfolders are invisible to it, so flatten your structure first or point it at each folder separately. Second, txt_path is a promise, not a file - those .txt files don't exist until a save node actually writes them, so don't go looking for them after this runs. Third, and this is the real one: the node outputs lists, and this pack ships no loop node (it's a three-node pack - Media List, Save Media with Tags, Tagger from Glm4vPlus). To process every file you either wire the lists into a loop/iteration node from another pack, or run the workflow once per file. The example workflow in the repo is a single pass, which tells you the author's own habit.

    Installing it

    ComfyUI Manager (search "ComfyUI-VideoTagger") or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/civen-cn/ComfyUI-VideoTagger
    cd ComfyUI-VideoTagger
    pip install -r requirements.txt
    

    Then restart ComfyUI. One thing worth knowing even if you only want this node: the pack imports the zhipuai library at module load, so if the requirements install was skipped (common when you clone by hand), none of the three nodes appear in your node list - not just the tagger. Run pip install -r requirements.txt and restart, and Media List shows up. No model files, no VRAM - this node is just a file scanner wearing a ComfyUI badge.

    CategoryVideoTagger

    Inputs (2)

    NameTypeDefaultDescription
    directorySTRING
    file_typesCOMBOvideo2 options: video, image

    Outputs (4)

    NameTypeDescription
    media_pathSTRING
    txt_pathSTRING
    absolute_directorySTRING
    file_countINT