ComfyUI Node

SaveMP4

Turn a frame batch into an actual MP4, audio and all

By 807502278·Created 2 years ago·Updated 11 months ago· 21
SaveMP4
  • images
  • audio
  • output_path
filename_prefixMP4Video
frame_rate25.0
crf23

ComfyUI represents video as a batch of images under the hood - a stack of frames, no different structurally from a batch you'd generate for anything else. That's convenient for processing, but it's not a video file, and the moment you actually want an MP4 you can play back, share, or upload, you need an encoding step. This node is that step: feed it a frame batch, get a real MP4 out, with an optional audio track muxed in.

It's part of ComfyUI-WJNodes, a personal utility pack from an author known only by the GitHub handle 807502278 - a genuinely practical, unglamorous node in a pack that's mostly made of those.

What it does

It takes your frame batch and encodes it to H.264 video in an MP4 container, using the two parameters that actually matter for output quality and file size, plus an optional audio input if you want the result to have sound.

Inputs and outputs that matter

  • images - the frame batch to encode.
  • filename_prefix - default MP4Video.
  • frame_rate - default 25, adjustable from 1 to 400 in steps of 0.1. Set this to match whatever frame rate your source frames actually represent - a mismatch here doesn't corrupt anything, it just makes the output play back faster or slower than intended relative to your source.
  • crf - Constant Rate Factor, the standard quality/size control for H.264 encoding, default 23. Lower values mean higher quality and bigger files; higher values mean more compression and smaller files. As a rough guide from general video-encoding practice: values around 18 are close to visually lossless, the low-to-mid 20s (where the default sits) is a reasonable everyday balance, and anything much past 30 starts showing visible compression artifacts. If your output looks blocky or smeary, lowering crf is the first thing to try.
  • audio (optional) - mux an audio track into the output alongside the video.

The single output, output_path, is the saved file's location - wire it into a preview, a log, or another node in this pack (like Load_Image_From_Path, if for some reason you needed to reference it again) the same way Save_Image_Out's path output works for stills. It's also marked as an output node, so it runs as a terminal step even without anything consuming output_path.

Installing it

ComfyUI Manager: search "ComfyUI-WJNodes." Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/807502278/ComfyUI-WJNodes.git

Restart ComfyUI afterward. Video encoding depends on ffmpeg being available in your environment - the README notes most dependencies are already covered by a standard ComfyUI install, but if this node fails specifically at the encoding step rather than on load, a missing or misconfigured ffmpeg is the first thing to check, since that's what's actually doing the H.264 encoding underneath.

Where people get tripped up

frame_rate is the most common source of "why does my video look sped up / slowed down" confusion - this parameter doesn't inspect your source and guess; it's exactly what you tell it, and if it doesn't match the frame rate your upstream generation or interpolation step actually produced, the timing will be off even though every individual frame is correct.

crf confuses people coming from bitrate-based encoders because the direction is inverted from what feels intuitive - lower number, higher quality, bigger file, which is the opposite of how a "quality slider going up" usually reads. If your output file is unexpectedly huge, you probably want a higher crf, not a lower one.

This is a small node from a pack with no public troubleshooting trail beyond its own README, so beyond the two parameters above, general H.264/ffmpeg knowledge - not anything WJNodes-specific - is what you're actually relying on if something about the encode itself looks wrong.

CategoryWJNode/video/video_file

Inputs (5)

NameTypeDefaultDescription
imagesIMAGE
filename_prefixSTRINGMP4Video
frame_rateFLOAT25.01–400
crfINT230–51
audiooptAUDIO

Outputs (1)

NameTypeDescription
output_pathSTRING