Nodes/ComfyUI-ffmpeg-toolkit/FFmpeg Merge Frames
ComfyUI Node

FFmpeg Merge Frames

Frames back to video — the node that finishes every video workflow

By Conlller·Created 8 months ago·Updated 7 months ago· 0
FFmpeg Merge Frames
  • frames
  • video
  • frames
fps30

You generated 81 frames of Wan video. Now what? You've got a pile of images and no way to watch them as a clip. FFmpegMergeFrames is the bookend that turns that frame batch into an actual .mp4 - it's the last node in a video workflow, the one that makes the thing you generated something you can play, upload, and show somebody.

Video pipelines spend all their time in latent space, and it's easy to forget that at the very end you need a real file. This node does the closing act: it writes your frames to disk, hands them to ffmpeg, and returns the result as ComfyUI's VIDEO type, ready for a Save Video or Video Output node. It ships in the same tiny ffmpeg-toolkit pack as FFmpeg Split Video, so if you used that to pull footage in, this is its mirror image going out.

How it works

The mechanism is dead simple and that's the point. Each frame is saved as a PNG to ComfyUI's temp directory, then ffmpeg runs:

ffmpeg -framerate <fps> -i frame_%06d.png -c:v libx264 -pix_fmt yuv420p output.mp4

Two details in that command are worth knowing because they're the difference between a video that plays and one that doesn't. -c:v libx264 gives you the h264 encoding every player and every web upload handles. And -pix_fmt yuv420p - that's 4:2:0 chroma subsampling, which is what browsers and most players actually support. Without it you get green-tinted or unplayable files. Both are baked in, so you get a boring, compatible mp4 on the first try.

The inputs and outputs

Only two things to touch:

  • frames - your IMAGE batch (or a VIDEO, see below).
  • fps - default 30, range 1–120. This is the playback rate of the output, so match it to whatever framerate you generated at - if your latent sequence was 16 fps, don't leave it at 30 unless you want fast-forward.

The outputs are where this node earns its keep:

  • video (VIDEO) - the finished mp4, wrapped in ComfyUI's video type. Wire this to a Save Video node.
  • frames (IMAGE) - a straight pass-through of your original frames. One run, and you can save the mp4 and keep feeding the frames downstream. It also means feeding this node a VIDEO instead of a frame batch just decodes it and hands you its frames - a free demux if you ever need one.

The one version gotcha

The VIDEO output depends on ComfyUI's newer video support (VideoFromFile in the backend API). If your build predates it, the node raises "Video output is not available in this ComfyUI build." That's not the pack's fault - update ComfyUI. This pack is small and current; it assumes you aren't running a two-year-old snapshot.

Install and the ffmpeg dependency

ComfyUI Manager - search "ComfyUI-ffmpeg-toolkit" - or:

cd ComfyUI/custom_nodes
git clone https://github.com/RCAKangle/ComfyUI-ffmpeg-toolkit

then restart. Python-side it only needs numpy and Pillow, which a stock ComfyUI already has. The real external requirement is the system ffmpeg binary on your PATH (brew install ffmpeg, sudo apt install ffmpeg, or the gyan.dev Windows build). Missing that is the classic "FFmpeg not found" error - and no, a pip ffmpeg package doesn't satisfy it, it checks for the executable. A long clip means writing a lot of PNGs to temp, so a 20-second 60fps render can add a couple of minutes of disk churn; that's normal, not a hang.

Categoryffmpeg

Inputs (2)

NameTypeDefaultDescription
framesIMAGE,VIDEOFrame batch to merge into a video.
fpsFLOAT301–120

Outputs (2)

NameTypeDescription
videoVIDEO
framesIMAGE