Nodes/ComfyUI-FFmpeg/🔥Frames2Video
ComfyUI Node

🔥Frames2Video

Stitch a folder of images back into an mp4

By MoonHugo·Created 2 years ago·Updated 4 months ago· 146
🔥Frames2Video
    • frame_path
    • output_path
    frame_pathC:/Users/Desktop
    fps30
    video_namenew_video
    output_pathC:/Users/Desktop/output
    deviceCPU
    audio_pathC:/Users/audio.mp3

    Frames2Video is the return trip from Video2Frames (or from ImagesSave, the pack's tensor-to-disk node). Point it at a directory full of PNGs, give it an fps, and it encodes them into a single mp4. This is the node that closes the loop on every "video → AI-processed frames → video" workflow, which is the bread and butter of ComfyUI video work - same reason people keep VHS tapes of their own pipelines, essentially.

    How it works

    It lists every image in the folder, sorts by filename, guesses the frame dimensions from the first image, then hands FFmpeg a number-pattern template - so frame_00000042.png becomes frame_%08d.png and FFmpeg decodes them in order. Encoding defaults to libx264 at crf 28 (small file, slightly soft), or h264_nvenc at cq 22 if you set device to GPU. That GPU option is only meaningful on an NVIDIA card - it won't magically speed things up on AMD or Apple silicon.

    The inputs that matter

    • frame_path - the directory of images. Must exist and contain at least one image.
    • fps - frame rate, default 30, min 1, max 120. This is where people silently ruin their videos. If you extracted at 24fps and rebuild at 30, your clip runs ~25% too fast. Save yourself the headache: wire the fps output from Video2Frames straight in here.
    • video_name - filename (no extension needed, .mp4 is appended). The output lands in output_path, which again must be a pre-existing directory.
    • audio_path - optional. Drop in the audio.mp3 that Video2Frames left next to your frames and the finished clip gets its soundtrack back. If you pass a path that doesn't exist, the node errors out, so leave it empty when you don't have one.

    Outputs

    Returns frame_path and output_path (the full path to the finished mp4) - both plain strings. There's no video preview widget here; you write the file and go look at it on disk.

    Install

    Same pack-wide story: the Python side is essentially nothing (requirements.txt is just pathlib), so the only real dependency is FFmpeg on your PATH. Install the pack via ComfyUI Manager (search "ComfyUI-FFmpeg") or:

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

    then restart ComfyUI.

    Gotchas

    • Output files are auto-named with a timestamp, so you won't overwrite your previous render - but you also won't know which file is which without checking the clock.
    • The images must be sorted-numeric to encode in the right order. The pack's own ImagesSave node writes zero-padded names (output_image_000000001.png) precisely so this works. If you dump frames from other tools, make sure they're zero-padded - lexicographic sort will otherwise put frame_2.png after frame_19.png.
    • Odd frame dimensions can trip up libx264; the encode will error with an "even width/height" complaint if your frames are odd-sized. Scale them to even dimensions first.
    Category🔥FFmpeg

    Inputs (6)

    NameTypeDefaultDescription
    frame_pathSTRINGC:/Users/Desktop
    fpsFLOAT301–120
    video_nameSTRINGnew_video
    output_pathSTRINGC:/Users/Desktop/output
    deviceCOMBOCPU2 options: CPU, GPU
    audio_pathoptSTRINGC:/Users/audio.mp3

    Outputs (2)

    NameTypeDescription
    frame_pathSTRING
    output_pathSTRING