Nodes/ComfyUI-FFmpeg/🔥AddAudio
ComfyUI Node

🔥AddAudio

Slap a soundtrack onto a silent video, no re-encode needed

By MoonHugo·Created 2 years ago·Updated 4 months ago· 146
🔥AddAudio
    • video_complete_path
    video_pathC:/Users/Desktop/video.mp4
    audio_fromaudio_file
    file_pathC:/Users/Desktop/output
    delay_play0
    output_pathC:/Users/Desktop/output/

    AddAudio does one simple thing: mux an audio file onto a video. You have a silent mp4 (every AI-generated video ever, plus anything that came out of Frames2Video without an audio_path) and you want music or voiceover on it. The nice part - and the reason you should reach for this over a generic converter - is that it stream-copies the video track, so the video itself is never re-encoded. That makes it effectively instant and lossless; the source video's quality is untouched.

    How it works

    It runs FFmpeg with -c:v copy -c:a copy, which means no re-encoding on either side: the video bytes are copied as-is and the audio stream is copied in. The only real processing is the delay_play offset, applied with -itsoffset so your audio can start a few seconds late - handy for syncing narration to something that happens partway through. One honest limitation: stream copy can't fix mismatched durations. If the video is longer than the audio, the tail is silent; if shorter, the audio gets cut at the video's end. Fine for music beds, fiddly for precisely-timed voiceover.

    The inputs that matter

    • video_path - the silent video. Must exist and have a video extension.
    • audio_from - audio_file or video_file. The clever bit: you can pull the audio out of a second video instead of a standalone audio file, which saves you an ExtractAudio step when you want to transplant someone's soundtrack from one clip to another.
    • file_path - where the audio (or second video) lives. If you pick video_file, the node verifies that file actually has an audio track and errors out if it doesn't - that's a real "I picked the wrong file" tripwire, and it's nice to have.
    • delay_play - seconds of silence before the audio starts, default 0.
    • output_path - pre-existing directory for the result (auto-named with a timestamp).

    Outputs

    A single video_complete_path string pointing at your new, now-audible file. Nothing else, no preview.

    Install

    This pack's install is the same everywhere, and it's refreshingly light: requirements.txt is just pathlib. The actual prerequisite is an FFmpeg binary on your PATH - every node here is a wrapper around the ffmpeg command. Install via ComfyUI Manager (search "ComfyUI-FFmpeg") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MoonHugo/ComfyUI-FFmpeg
    cd ComfyUI-FFmpeg
    pip install -r requirements.txt
    

    Then restart ComfyUI.

    Gotchas

    • If the video already has a soundtrack, adding another doesn't mix them - FFmpeg's -map 0:v -map 1:a here replaces the old audio with the new one. If you wanted them layered, that's not this node.
    • Timestamped output names mean running the same video through twice gives you two files rather than overwriting. That's by design across the whole pack.
    • No -shortest flag is used, so a long audio file gets truncated at the video length rather than extending the video - don't expect this node to stretch the picture to fit your audio.
    Category🔥FFmpeg

    Inputs (5)

    NameTypeDefaultDescription
    video_pathSTRINGC:/Users/Desktop/video.mp4
    audio_fromCOMBOaudio_file2 options: audio_file, video_file
    file_pathSTRINGC:/Users/Desktop/output
    delay_playINT0
    output_pathSTRINGC:/Users/Desktop/output/

    Outputs (1)

    NameTypeDescription
    video_complete_pathSTRING