ComfyUI Node

Video Has Audio

Know whether your input video has audio before you build the audio pipeline

By pipelet-ai·Created 6 months ago·Updated 4 months ago· 0
Video Has Audio
    • has_audio
    • int_value
    input_file

    If you've built any video workflow with Wan or LTX, you know the pain: your source file may or may not have an audio track, and your pipeline needs to behave differently either way. VideoHasAudio answers exactly one question - "does this file have audio?" - with a clean boolean, so you can branch before you commit to a path.

    You give it one string (a file path), it gives you two outputs:

    • has_audio (BOOLEAN) - true if the file has at least one audio stream
    • int_value (INT) - 1 or 0, the same answer in a form some nodes prefer

    The classic use is a gate: feed has_audio into a switch node (rgthree's Any Switch is the usual suspect) and pick between "carry the source audio through" and "generate/attach audio" branches. In the LTX world specifically - where the model generates synchronized audio and audio handling is one of the perennial quality complaints - knowing whether your input even has a track determines whether an audio-muxing step should run at all.

    How it works

    No Python packages, no ML. The node shells out to ffprobe (part of ffmpeg) and asks it to list audio streams:

    ffprobe -v error -select_streams a -show_entries stream=index -of json <file>
    

    If that JSON comes back with any streams, you've got audio. Before probing, it resolves your string into an actual file: absolute path first, then ComfyUI's annotated path helper, then the input/output/temp directories, then a bare relative path. If nothing resolves, it raises a clear error naming every place it looked.

    Two details worth knowing. input_file is forceInput: false, so by default you type or drag a path into the widget - but you can also right-click and convert it to accept a connection from another node. And IS_CHANGED returns the path, meaning the node re-runs whenever the file path changes, which keeps caches from going stale in long workflows.

    The one thing that bites: ffprobe

    This pack has no requirements.txt - zero Python dependencies. The entire external requirement is that ffprobe exists on your PATH, and if it doesn't, the node raises "ffprobe not found. Please install ffmpeg and ensure ffprobe is on PATH."

    Check yours:

    ffprobe -version
    

    If that fails: sudo apt install ffmpeg on Debian/Ubuntu, brew install ffmpeg on macOS, and on Windows either add ffmpeg to PATH or use a full build from gyan.dev (the "essentials" build includes ffprobe; some minimal bundles don't). A common trap: ComfyUI installs that bundle imageio-ffmpeg for video loading ship an ffmpeg binary but not ffprobe, and neither is on PATH - so video nodes may work while this one errors. Install real ffmpeg and move on.

    Input paths and errors

    Because it's just a string, the path has to point at something real. Easiest pattern: drop the file in ComfyUI/input and type just the filename - the resolver finds it there. Absolute paths also work. If you get Video file not found: '<path>'. Checked absolute path and ComfyUI input/output/temp directories., the file isn't where the resolver looks.

    Install

    Same routine as the rest of the pack, no pip installs, no models:

    cd ComfyUI/custom_nodes
    git clone https://github.com/pipelet-ai/ComfyUI-PredefinedResolution.git
    

    Restart ComfyUI, or use ComfyUI Manager and search "PredefinedResolution."

    Verdict: a small, well-behaved utility that earns its keep the moment you build a video pipeline with branching audio handling. Just install ffmpeg first - that's the whole setup story.

    Categoryutils

    Inputs (1)

    NameTypeDefaultDescription
    input_fileSTRING

    Outputs (2)

    NameTypeDescription
    has_audioBOOLEAN
    int_valueINT