Nodes/VRGameDevGirl Video Enhancement Nodes/VRGDG Build Video Output Path (General_SRT)
ComfyUI Node

VRGDG Build Video Output Path (General_SRT)

Build a per-chunk output filename — and decide whether old takes get backed up

By vrgamegirl19·Created about a year ago·Updated 2 days ago· 717
VRGDG Build Video Output Path (General_SRT)
    • output_path
    output_folder
    chunk_index
    base_namevideo
    overwrite_mode

    Naming files is the least glamorous part of a chunked video workflow, and also the part that bites you when it goes wrong. VRGDG_BuildVideoOutputPath_General_SRT computes the output path for one video-chunk's save, in the pack's canonical naming scheme, and optionally moves an existing take into a backup/ folder before it gets overwritten. It never writes a file itself - the docstring is explicit: "Does NOT save files." It just hands you the STRING path so a save node downstream knows exactly where to write.

    It's the SRT flavor of the pack's path-builder family, wired into the per-set generation loop so every chunk lands with a deterministic, index-carrying filename.

    How it works

    Given output_folder, chunk_index, and base_name, it builds:

    {base_name}_{human_index:04d}_{chunk_index:04d}
    

    where the human index is chunk_index + 1. So chunk 0 of base video becomes video_0001_0000, chunk 5 becomes video_0006_0005. The doubled index looks redundant, but it's deliberate: the _0001_ part is for you (which chunk in the sequence) and the _0000 part is the raw index that loop logic keys on, so a human and the graph can agree on which file is which. It also strips trailing _<digits> groups from base_name first, so re-feeding an already-numbered base doesn't double-index.

    overwrite_mode is the interesting knob. In backup mode, if a file with the computed prefix already exists as .mp4 in the folder, it's moved into output_folder/backup/ before the new take overwrites the main spot - same filename inside backup, so a previous backup gets replaced. That's the "keep my last good take while the new one writes" guard, so a failed render doesn't destroy the only version you had.

    Inputs and outputs

    • output_folder - where the file will live (created if missing).
    • chunk_index - the zero-based chunk; drives both parts of the filename.
    • base_name - the stem, default video.
    • overwrite_mode - the STRING mode; the backup behavior activates when it's set to backup.

    Output: output_path, a STRING you wire into a Video Combine / save node's filename. That's the whole contract.

    Gotchas

    Note the filename has no extension - the combine node appends .mp4. And the backup matching checks the prefix against every .mp4 in the folder, so a base_name collision between two different runs in the same folder will move each other's files into backup. Keep one run per folder and you'll never see it. Install is the usual pack ritual: ComfyUI Manager → search "vrgamedev", or git clone https://github.com/vrgamegirl19/comfyui-vrgamedevgirl into ComfyUI/custom_nodes, restart.

    CategoryVRGDG

    Inputs (4)

    NameTypeDefaultDescription
    output_folderSTRING
    chunk_indexINT
    base_nameSTRINGvideo
    overwrite_modeSTRING

    Outputs (1)

    NameTypeDescription
    output_pathSTRING