Nodes/ZMG PLUGIN/Load Audio From URL
ComfyUI Node

Load Audio From URL

Pull a music file off the internet and hand it to your video pipeline

By fq393·Created 2 years ago·Updated 7 months ago· 8
Load Audio From URL
    • audio
    • file_path
    • saved
    • has_audio
    audio

    ComfyUI ships with a way to load audio from your local input folder, but not from a URL. That gap is exactly what this node fills: give it an http(s) link to an mp3, a file:// path, a base64 data:audio/... URI, or even a ComfyUI /view? reference, and it downloads the file into your input directory and hands you a ready-to-use AUDIO object. The obvious use case is the one in the pack's own docs: grab a soundtrack and feed it to the Combine Image+Audio → Video node to score a generated clip.

    How it works

    It fetches the bytes (via requests for http, direct reads for local forms), saves them to input with a deduplicated filename (it appends _1, _2 if the name's taken), then decodes the audio to raw PCM using pydub and wraps it in the standard AUDIO dict - waveform tensor plus sample_rate. The README is careful to note it decodes to PCM but does not re-encode, which keeps things fast and lossless until the video mux step.

    The one thing to know before you use it

    The tooltip says the multiline box lets you paste multiple URLs that get "按顺序拼接为单一音轨" (concatenated into one track). That's a lie. Read the source and you'll see it takes urls[0] - the first non-empty line - and ignores the rest. So plan on one URL per node instance. If you need to combine tracks, do it elsewhere. Everything else about it works as advertised, but this is the kind of detail that'll have you re-reading the docs for an hour.

    Inputs and outputs

    The only required input is audio - your URL or path, multiline. That's it; no optional knobs worth mentioning.

    Outputs:

    • audio - the AUDIO dict, for wiring into video nodes or anything that accepts audio.
    • file_path - where the file landed in input.
    • saved - whether it saved successfully.
    • has_audio - whether a usable audio stream came back (false if the file was empty or undecodable). Nice for conditional wiring: check has_audio before you mux.

    What can break

    The big one: this node requires pydub, which sits in the pack's requirements.txt but isn't installed if you skipped that step. If you're getting an ImportError, pip install pydub. pydub also needs ffmpeg under the hood to decode most formats - so, like the video nodes in this pack, you want a working ffmpeg on your system. And remember the timeout on http fetches is a fixed 10 seconds, so huge files on slow links can time out.

    Installing

    Part of the ZMG pack. 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 ComfyUI; find it under ZMGNodes/audio. Solid little node - just remember it's one track per node, and it needs pydub to exist.

    CategoryZMGNodes/audio

    Inputs (1)

    NameTypeDefaultDescription
    audioSTRING支持 http/https、file://、data:audio、ComfyUI /view?;多行按顺序拼接为单一音轨

    Outputs (4)

    NameTypeDescription
    audioAUDIO
    file_pathSTRING
    savedBOOLEAN
    has_audioBOOLEAN