视频插入音频
Mux audio onto a video with ffmpeg, without leaving ComfyUI
- 视频地址
VideoAddAudio (视频插入音频, "insert audio into video") is the pack's answer to a boring, repeated task: you generated a video, you generated an audio track, now you need them in one file. It's a thin wrapper around ffmpeg, and that's exactly what you want - it means it's fast, predictable, and doesn't re-encode anything you don't ask it to.
How it works
You give it a video path and an audio path, and it runs:
ffmpeg -y -hide_banner -loglevel error -i <video> -i <audio> -vcodec copy <out.mp4>
The video stream is copied - no re-encode - and the audio is copied too, except when the source is a WAV, which gets transcoded to AAC so it plays nicely in an MP4 container. Because it's a mux, not a transcode, it's near-instant even for long clips.
The inputs:
videoPath- STRING, markedforceInput. Wire it from the pack'sVideoPathnode or any node that hands you a video file path.audioPath- STRING,forceInput. This is where the pack's ownText2AutioEdgeTtsshines: generate narration, wire the returned audio path straight in.filename_prefix- defaults tocomfyUI, so the result lands atComfyUI/output/video/comfyUI_00001_.mp4.
The single output is 视频地址, the path to the new MP4. It's an output node, and the UI shows the save path in the workflow's results panel.
Audio is limited to mp3, wav, and flac - anything else raises an exception before ffmpeg even runs. If the video or audio file doesn't exist, you get a clear "视频文件不存在" / "音频文件不存在" error.
The trap: ffmpeg must be on your PATH
This node shells out with os.system(), which means it calls the ffmpeg binary the same way you would in a terminal. ComfyUI's own bundled ffmpeg doesn't count - if ffmpeg isn't on PATH, the command silently fails and the node "succeeds" while producing no file. That's the one failure mode that will genuinely confuse you, because nothing errors out.
On Windows portable, install ffmpeg separately and add it to PATH (or drop ffmpeg.exe somewhere on PATH). On Linux, your package manager handles it:
sudo apt install ffmpeg
Then confirm it works before blaming the node:
ffmpeg -version
Installing it
Part of the ComfyUI_Lam pack - ComfyUI Manager (search "ComfyUI_Lam") or:
cd ComfyUI/custom_nodes
git clone https://github.com/yanlang0123/ComfyUI_Lam
Restart ComfyUI. No model downloads for this node; the cost is just the pack's overall heavy requirements.txt (imageio, opencv, and friends) that its install.bat installs.
Troubleshooting
If the workflow completes but no MP4 shows up, the almost-certain cause is ffmpeg not on PATH - check with ffmpeg -version. If you get an exception, it's the file check (wrong path) or an unsupported audio extension. And a subtle one: the result output returns just the filename, but the UI text prints the full path - read the UI line if you're scripting around the output.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| videoPath | STRING | — | |
| audioPath | STRING | — | |
| filename_prefix | STRING | comfyUI | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| 视频地址 | STRING | — |