ComfyUI Node

Replace Video Audio

Swap a video's audio inside the graph

By alice-lab-dev·Created about a month ago·Updated 10 days ago· 2
Replace Video Audio
  • audio
  • video
  • video
video_encoderauto

You've generated audio - a TTS voiceover, a music clip, a foley pass - and you have video. The obvious next step is "put my audio on the video, in sync, and keep the picture." That's a muxing job, and until this pack existed it meant leaving ComfyUI for an external tool. Replace Video Audio does it in one node: keep the video frames, replace the soundtrack with your connected AUDIO, and hand you a new VIDEO - padded or trimmed to fit, so it can't drift past the end.

It's the video-audio glue in ComfyUI ALICE Lab Audio Tools, the brand-new alpha pack (Apache 2.0, no pip deps, bilingual EN/JA) from ALICE Lab. The pack's own example workflow shows the intended shape: Load Media Range → audio processing or the Audio Mixer → Replace Video Audio.audio, with the original video into Replace Video Audio.video, then Preview Video on the result.

How it works

The node shells out to ffmpeg (which is why the pack needs ffmpeg on your PATH at all). It writes the first batch of your AUDIO as a 16-bit PCM WAV for reliable input, then muxes:

  • Video is stream-copied when possible - the picture is copied without re-encoding, so it's fast and doesn't degrade.
  • Audio is encoded as AAC at 192 kbps.
  • Short audio is padded with silence; long audio is trimmed to the video duration. That's the "it always fits" guarantee.
  • If the video stream-copy fails (codec or container mismatch), it retries with H.264 (libx264, CRF 18, yuv420p). So the fallback needs libx264, but only when the copy path fails - the README calls this out explicitly.

There's also a deliberate behavior when video isn't connected: downstream video execution is blocked silently. That's by design - it keeps graph wiring intact while an upstream Media Range is temporarily selecting audio-only media. If nothing downstream runs, this is why.

Inputs and outputs

  • audio - required, the replacement soundtrack.
  • video - optional, the picture to keep.

Single output: video, a new VIDEO object (MP4) with your soundtrack. From there it goes to Preview Video to look at it, or straight to your save node.

The gotchas

Remember the output is MP4 - if you need another container, this isn't the node. If your video is a weird codec, the H.264 fallback will handle it but re-encodes the picture (slower, and the CRF 18 encode is lossy, though very high quality). And the audio is force-fitted to the video length: a 5-second clip of audio on a 2-minute video becomes 2 minutes of mostly silence at the end, so trim first with a Media Range node or the Mixer. Get the cut right upstream and this node is genuinely fire-and-forget.

Install

# ComfyUI Manager → search "ComfyUI ALICE Lab Audio Tools" → Install → restart
# or:
cd ComfyUI/custom_nodes
git clone https://github.com/alice-lab-dev/ComfyUI-ALICE-Lab-Audio-Tools
# restart, then Add Node → ALICE_Lab → Video

Pack-wide requirements: ffmpeg + ffprobe on the ComfyUI process PATH (macOS Homebrew paths auto-checked), a current ComfyUI with AUDIO/VIDEO types and comfy_api.latest. No model downloads, no Python dependencies.

CategoryALICE_Lab/Video

Inputs (3)

NameTypeDefaultDescription
audioAUDIO
videooptVIDEO
video_encoderoptCOMBOauto4 options: auto, nvenc, videotoolbox, cpu

Outputs (1)

NameTypeDescription
videoVIDEO