Nodes/ZMG PLUGIN/Combine Image+Audio → Video
ComfyUI Node

Combine Image+Audio → Video

Turn generated frames into a real video file — with sound, if you bring it

By fq393·Created 2 years ago·Updated 7 months ago· 8
Combine Image+Audio → Video
  • images
  • audio
  • video
frame_rate24
filename_prefixZMG
formatvideo/h264-mp4
pix_fmtyuv420p
crf19
save_metadatatrue
trim_to_audiofalse
pingpongfalse
save_outputtrue

This is the "finish the job" node in the ZMG pack. You've generated a stack of frames (from AnimateDiff, a video model, or the pack's own Text To Image node), and now you want an actual video file on disk. Feed it an IMAGE batch and it encodes an mp4, webm, or mov. Wire in an AUDIO stream and it muxes the soundtrack in too. One node, real output, no separate ffmpeg step on the command line.

How it works

It's ffmpeg orchestration, not a model. The node writes your frames as raw video to ffmpeg's stdin, encodes with the codec you pick (H.264 for mp4, VP9 for webm, ProRes for mov), then runs a second ffmpeg pass to mux audio on top - AAC for mp4/mov, Opus for webm. That means you need an ffmpeg binary on your PATH. It's not in the pip requirements, and no amount of pip install will fix a missing binary. On most ComfyUI installs ffmpeg ships along, but if you get a cryptic subprocess error, check ffmpeg -version first.

Inputs that matter

  • images - your frame sequence, shape B x H x W x C with 3 or 4 channels. 4 channels means alpha, and the node will quietly upgrade a yuv420p pixel format to yuva420p so transparency doesn't just get dropped.
  • format - video/h264-mp4, video/vp9-webm, or video/prores-mov. Pick mp4 unless you need transparency (then mov/ProRes is the safer bet) or web delivery.
  • frame_rate - default 24; 16/24/30 are the usual suspects.
  • crf - quality knob, 0–51, default 19. Lower = clearer and bigger; 18–23 is the sane range. This is the one beginners actually fiddle with.
  • trim_to_audio - on: video is cut to the audio's length. Off (default): the video is padded with silence so it keeps its full duration.
  • pingpong - plays frames forward then back, effectively doubling a short clip's length. Cute for looping an animation.
  • save_output - on writes to your output folder; off writes to temp, which ComfyUI cleans up later. Filenames get a counter plus timestamp, so you won't clobber earlier runs.

Optional audio takes the AUDIO dict format (waveform + sample_rate) - the exact thing the pack's Load Audio From URL node produces.

What comes out

A single video output typed as IO.VIDEO, so it plugs straight into newer video preview and upload nodes rather than just sitting on disk. The pack's own example pipeline shows the intended shape: generate frames with Text To Image, load a track with Load Audio From URL, and mux them here.

Gotchas

Beyond the ffmpeg binary: this node leans on comfy_api.latest and the IO.VIDEO type, which are recent additions to ComfyUI. On an older ComfyUI install the node can fail to import at all - update ComfyUI before you blame the pack. Odd frame dimensions are trimmed to even numbers automatically (H.264 insists), so a 513px-wide image becomes 512, not an error.

Installing

ComfyUI Manager → search "ZMG" / "ComfyUI-ZMG-Nodes", or:

cd ComfyUI/custom_nodes
git clone https://github.com/vanche1212/ComfyUI-ZMG-Nodes
cd ComfyUI-ZMG-Nodes
pip install -r requirements.txt

Restart, and confirm ffmpeg -version works in your terminal. No model downloads - this pack is pure Python plus a binary you already have.

CategoryZMGNodes/image

Inputs (11)

NameTypeDefaultDescription
imagesIMAGE输入帧序列,形状 BxHxWxC,C=3/4
frame_rateFLOAT24视频帧率,常用 16/24/30
filename_prefixSTRINGZMG文件名前缀,系统会自动追加计数与时间戳
formatCOMBOvideo/h264-mp4视频容器/编码:mp4(H.264)、webm(VP9)、mov(ProRes)
pix_fmtCOMBOyuv420p像素格式:yuv420p(无透明)、yuva420p/yuva444p10le(有透明)
crfINT190–51质量系数:越小越清晰、体积越大(建议18-23)
save_metadataBOOLEANtrue写入创建时间等元数据
trim_to_audioBOOLEANfalse按音频长度裁剪;关闭则为视频补齐静音
pingpongBOOLEANfalse帧序列乒乓播放,延长时长
save_outputBOOLEANtrue保存到output目录;关闭保存到temp目录
audiooptAUDIOAUDIO字典:waveform+sample_rate

Outputs (1)

NameTypeDescription
videoVIDEO