Nodes/ComfyUI Fictiverse Nodes/Get Last Output Video Path
ComfyUI Node

Get Last Output Video Path

Find the newest render on disk without guessing

By Fictiverse·Created 3 years ago·Updated 2 months ago· 28
Get Last Output Video Path
    • video_path
    ◄subfolder►
    ◄sort_byDate►

    Get Last Output Video Path scans your ComfyUI output folder and returns the full path to the most recent video file (.webp or .mp4) in it. One string comes out: the absolute on-disk path of your newest render.

    The "why" is automation. ComfyUI saves videos to disk, but the graph itself often doesn't know where the file landed - a video saver node reports a filename back to the UI, not necessarily to the rest of the graph. If you want to then do something with that file - feed it to a second workflow, send it somewhere, chain it into a post-processing node that wants a path string, or have workflow A hand its output off to workflow B - you need the path as data. This node reaches out and grabs it by looking at what's actually on disk.

    It's the classic glue-node move: the pack is full of small nodes that connect things ComfyUI doesn't connect natively, and this one connects "video just rendered" to "everything else that wants a file path."

    How it works

    It looks in ComfyUI/output/ - specifically output/<subfolder> if you give it one - finds every .webp and .mp4 file, and picks one based on sort_by:

    • Date (default) - the most recently modified file wins.
    • Name - the alphabetically-last filename wins, which is usually (but not guaranteed) a proxy for "latest" when your filenames carry timestamps or counters.

    If the folder doesn't exist or contains no matching files, it returns an empty string rather than erroring - a graceful "nothing there" that downstream nodes have to be ready to handle.

    One important implementation detail: the node reports itself as always changed (it returns NaN from its change check), which means ComfyUI never caches its output. Every queue run re-scans the folder. That's intentional - the whole point is "what's the newest file right now" - but it means the node will always execute even if nothing upstream changed. Fine for its job, mildly surprising if you were hoping for graph-level deduplication.

    Inputs and outputs

    • subfolder (STRING) - a subfolder under output to search. Leave empty to search the top level. Useful if your video saver writes to output/videos/.
    • sort_by - Date or Name.

    Output:

    • video_path (STRING) - absolute path to the chosen file, or empty.

    Installing it

    Ships in ComfyUI Fictiverse Nodes. ComfyUI Manager → search "ComfyUI Fictiverse Nodes" → install → restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Fictiverse/ComfyUI_Fictiverse
    

    No dependencies, no models. Apache 2.0.

    Common issues

    Pack gotcha: ModuleNotFoundError: No module named 'custom_nodes.ComfyUI_Fictiverse' means the folder isn't named exactly ComfyUI_Fictiverse; rename and restart.

    Node-specific gotchas: it only looks in output - if your workflow saves elsewhere (a custom output directory, or a temp folder), the path won't be found and you'll get an empty string. It also only recognizes .webp and .mp4; other video containers are invisible to it. And "last modified" is a filesystem timestamp, so if you generate two videos in quick succession, the newest may not be the one you think it is - the modified time is set when the file was written, and a fast re-render can produce timestamps that look identical to the second. When in doubt, check the actual files in the folder.

    CategoryFictiverse

    Inputs (2)

    NameTypeDefaultDescription
    subfolderSTRING—
    sort_byCOMBODate2 options: Date, Name

    Outputs (1)

    NameTypeDescription
    video_pathSTRING—