Nodes/ComfyUI_Dados_Nodes/Video Last Frame
ComfyUI Node

Video Last Frame

Grab the last frame of a video and hand it to your graph

By DadoIrie·Created 2 years ago·Updated a day ago· 10
Video Last Frame
    • IMAGE
    mp4_path

    Video workflows have a recurring need: the last frame of a clip is the natural bridge to the next one. Finish a video, grab its final frame, feed that frame into an img2img pass, an upscaler, or a "what comes next" model. Video Last Frame is the two-line answer - you give it an mp4 path, it gives you the last frame as an IMAGE tensor.

    The timing matters more than it sounds. In i2v chains especially, the "last frame in" is what determines continuity to the next clip, and pulling it by hand (screenshot, image editor, praying) is miserable. This node automates exactly that handoff.

    How it works

    It shells out to ffmpeg, and the specific invocation is the interesting part. Rather than decoding the whole file and keeping the last frame, it uses -sseof -3 - "seek from the end of the stream by 3 seconds" - and extracts a single frame from there:

    ffmpeg -y -sseof -3 -i video.mp4 -update 1 -q:v 2 last_frame.png
    

    That's fast even on long videos because ffmpeg only decodes the tail. The extracted PNG is then converted into a standard IMAGE tensor (0–1 float, batch of 1). One input, mp4_path; one output, IMAGE.

    The caveats

    Two things from the source are worth knowing before you rely on it:

    • ffmpeg must be on your PATH. The node calls the ffmpeg command directly via subprocess. ComfyUI ships an ffmpeg in its own directory on many installs, but that's not always on PATH - if the node errors with "Failed to extract last frame" plus a "No such file or directory" style message in the logs, that's your ffmpeg, not your video. Point your environment at a working ffmpeg binary.
    • It's "the last 3 seconds," not literally the final frame. -sseof -3 lands within the final three seconds, so on a slow or variable clip you get a frame near the end rather than the exact last one. For continuity work that's usually fine - the difference is imperceptible in a 16+ fps clip.

    Also note the node expects a real, existing file path. Feed it a URL or a relative path that doesn't exist and it errors out with "mp4_path does not exist" before ffmpeg even runs.

    Why you'd reach for it

    Pair it with the pack's Video Merge to build chained clips: generate video A, extract its last frame, use that frame as the start of video B (via an i2v node), merge A+B, repeat. That loop is the entire reason this node exists, and it makes a decent hand-rolled "extend the video" pipeline. It also plays well with the pack's Preview Image node - last frame into a preview, so you can eyeball exactly where a clip ended.

    Install

    Part of Dados Nodes: ComfyUI Manager → "Dados Nodes", or

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

    then restart. The only real dependency is an on-PATH ffmpeg binary - no models, no keys.

    Common issues

    Beyond the ffmpeg-on-PATH gotcha (the big one), the only other failure people hit is the 3-second-tail behavior on videos with long frozen endings - if your clip ends with 10 seconds of black, "last frame" means black. Trim the clip first, or accept the tail. Otherwise this is one of the most dependable nodes in the pack: it either gives you a frame or tells you exactly why not.

    CategoryDado's Nodes/Video

    Inputs (1)

    NameTypeDefaultDescription
    mp4_pathSTRING

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGE