Nodes/TrentNodes/Latest Video Final Frame
ComfyUI Node

Latest Video Final Frame

Grab the last frame of the newest render — hands-free

By TrentHunter82·Created 9 months ago·Updated 4 days ago· 36
Latest Video Final Frame
    • final_frame
    • video_filename
    directory_path
    recursive_searchfalse
    video_extensionsmp4,avi,mov,mkv,webm,flv,wmv

    The iterative video loop has a classic shape: generate a clip, take its last frame, feed that frame back in as the seed image for the next clip. The part that's always fiddly is getting the last frame - you either wire up a decoder chain or you find yourself manually watching renders land and dragging files around. Latest Video Final Frame is the shortcut: it looks in a folder, finds the most recently modified video file, and pulls out its final frame as a clean IMAGE output.

    It's built for the "monitoring render outputs" pattern - the README's own description of the family. Queue a run, and the next time the graph executes, this node picks up whatever the renderer just dropped in the output folder and hands you its last frame, no filename typing, no VHS-style decoding chain.

    Inputs

    • directory_path - where to look for videos.
    • recursive_search - off by default; flip it on to scan subdirectories.
    • video_extensions - comma-separated list, defaulting to mp4,avi,mov,mkv,webm,flv,wmv. Trim it if you have stale files in odd formats.

    Outputs

    • final_frame - the last frame of the newest video, as an IMAGE tensor ready for a sampler or a preview.
    • video_filename - the name of the file it grabbed, so your graph knows which render it's looking at.

    How it works

    Under the hood it's simple and honest: glob for the extensions, sort by os.path.getmtime, take the newest, and use OpenCV to seek to the end and read the final frame. That's the whole mechanism - no ffmpeg, no model. It also degrades gracefully: if the folder has no videos, you get a black placeholder image and the filename output says "No video found" rather than a hard crash, which keeps an auto-queue loop alive instead of erroring out mid-batch.

    Install

    Ships in TrentNodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/TrentHunter82/TrentNodes.git
    cd TrentNodes
    pip install -r requirements.txt
    

    Restart and find it under Trent/Video. It needs OpenCV (in the pack's requirements) and nothing else.

    Gotchas

    The "newest" logic is by modification time, not name. That's usually right for renders, but it means a re-saved or touched file can jump the queue - if your output folder has 300 clips and you're chasing a specific one, this node will blithely hand you the most recent by time, which may not be the one you meant. Also note it reads the final frame of a file - if your video pipeline pads with end frames or adds a "next-chunk seed" frame, you'll get that padding frame, not the last real one. The pack's sibling, Latest Video Last N Frames, gives you the tail N frames, which handles the second problem neatly - grab a handful and pick the right one.

    CategoryTrent/Video

    Inputs (3)

    NameTypeDefaultDescription
    directory_pathSTRINGPath to directory containing video files
    recursive_searchBOOLEANfalseSearch subdirectories for video files
    video_extensionsSTRINGmp4,avi,mov,mkv,webm,flv,wmvComma-separated list of video file extensions

    Outputs (2)

    NameTypeDescription
    final_frameIMAGE
    video_filenameSTRING