Nodes/ComfyUI-FFmpeg/🔥ExtractAudio
ComfyUI Node

🔥ExtractAudio

Pull the soundtrack out of any video, in the format you actually want

By MoonHugo·Created 2 years ago·Updated 4 months ago· 146
🔥ExtractAudio
    • audio_complete_path
    video_pathC:/Users/Desktop/video.mp4
    output_pathC:/Users/Desktop/output
    audio_format.m4a

    ExtractAudio is the pack's utility for ripping a video's audio track out as a standalone file. It looks trivial, and honestly it is - but it's the kind of trivial you end up needing constantly once you're building video pipelines. Music from a clip you like, a voiceover track you need to feed into a transcription or upscale, or just grabbing the audio before you re-render the video and want to reattach it later. The pack's own Video2Frames node already extracts audio as a side effect, but this one lets you pick the exact format, which matters more than it sounds.

    How it works

    A single ffmpeg call with -vn (drop all video) and the codec for your chosen format. The interesting detail is that .m4a uses stream copy - -acodec copy - so the audio is extracted bit-for-bit with zero quality loss and near-instant. Every other format transcodes: .mp3 goes through libmp3lame at -q:a 2 (good quality, reasonable size), .wav becomes pcm_s16le (huge but lossless and universal), .flac is losslessly compressed, and so on.

    The inputs that matter

    Honestly, only two:

    • video_path - the source video.
    • audio_format - the dropdown of available formats: .m4a, .mp3, .wav, .aac, .flac, .wma, .ogg, .ac3, .amr, .aiff, .opus, .m4b, .caf, .dts. Default .m4a is the smart default: lossless copy and tiny effort. Pick .wav if you're about to process the audio somewhere that hates compressed formats, .mp3 if you're going to send it somewhere that requires it.
    • output_path - pre-existing directory. The file is named after the source video (video.mp4video.m4a), no timestamps here.

    Outputs

    One audio_complete_path string. Wire it into AddAudio or Frames2Video's audio_path and your round-trips get their sound back.

    Install

    Standard for the pack: FFmpeg on PATH is the real dependency (the requirements.txt is literally just pathlib). 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
    

    Restart ComfyUI.

    Gotchas

    • If your source video has no audio stream, .m4a's stream copy will either error or produce an empty file - the node doesn't check for an audio track up front like AddAudio does. If you get a weird output, ffprobe the source first.
    • .wav files from this node are uncompressed; a two-hour podcast becomes a multi-gigabyte monster. Don't say you weren't warned.
    • The timestamped-naming convention that protects most of this pack's outputs doesn't apply here - it's named after the source. Run twice, and the second run overwrites the first.
    Category🔥FFmpeg

    Inputs (3)

    NameTypeDefaultDescription
    video_pathSTRINGC:/Users/Desktop/video.mp4
    output_pathSTRINGC:/Users/Desktop/output
    audio_formatCOMBO.m4a14 options: .m4a, .mp3, .wav, .aac, .flac, .wma, +8

    Outputs (1)

    NameTypeDescription
    audio_complete_pathSTRING