Nodes/ComfyUI-VideoTagger/Save Media with Tags
ComfyUI Node

Save Media with Tags

Copy the clip, write the caption, done

By civen-cn·Created about a year ago·Updated about a year ago· 1
Save Media with Tags
    • status
    output_directory
    media_path
    tag_content

    This is the payoff node of the ComfyUI-VideoTagger pack - the "write it down" step after something figured out what your media is. You feed it a media file path and some tag text, and it does two boring-but-essential things: copies the file into an output folder and writes a same-name .txt next to it with the tags. That's it. It's the terminal of the pipeline, marked as an output node, which in ComfyUI-speak means it always runs and is what the graph ends on.

    How it works

    The mechanism is unapologetically plain Python. It creates the output directory if it doesn't exist (os.makedirs), checks the media file is actually there, copies it with shutil.copy2, and writes tag_content to base_name.txt in UTF-8. Two behaviors are easy to miss:

    • The copy is skip-on-exists. If a file with that name already lives in the output folder, the node quietly skips the copy and moves on. No overwrite, no warning. Re-running a workflow with updated tags updates the .txt but leaves the media alone - which is usually exactly what you want, until it isn't.
    • The .txt always overwrites. Same name, fresh write every run, so your latest tag_content wins.

    Also worth knowing: the status string it returns is in Chinese - a 成功:... (success) message or an 错误:... (error) message if the media path is missing. The error check means a bad path won't hard-crash your graph; it just hands you a Chinese error string.

    The inputs that matter

    Three required inputs, all plain strings:

    • output_directory - where the copies land. It's created for you if missing.
    • media_path - absolute path of the source media. Wire this to Media List's media_path output to process a scanned queue.
    • tag_content - the text written to the .txt. Wire this to the text output of Tagger from Glm4vPlus, or just type or pipe in any caption. The node doesn't care where the text came from.

    One output: status (STRING), for logging or feeding a text display.

    Where you'd actually use it

    The pattern the pack is built for: Media List scans a folder → the tagger (or you) produces text → this node copies the file and its caption into a curated output folder while leaving your raw footage untouched. That's a genuinely useful archival loop - you keep the messy originals where they are and collect the tagged selects in one place. Don't reach for it as a general file manager though: it keeps original filenames, does no dedup, and renames nothing. It's a lazy copy-plus-caption helper, and it's good at being exactly that.

    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. The one dependency in requirements.txt is zhipuai - the GLM API client - and because the pack imports it at module load, a skipped install means none of the three nodes appear, not just the tagger. If the pack's nodes are missing from your list, that's your first suspect. No model downloads here; this node itself touches nothing heavy.

    CategoryVideoTagger

    Inputs (3)

    NameTypeDefaultDescription
    output_directorySTRING
    media_pathSTRING
    tag_contentSTRING

    Outputs (1)

    NameTypeDescription
    statusSTRING