Nodes/ComfyUI_Lam/获取音频信息
ComfyUI Node

获取音频信息

Get an audio file's real specs

By yanlang0123·Created 2 years ago·Updated 18 days ago· 76
获取音频信息
    • 音频时长(秒)
    • 音频采样率
    • 音频通道数
    • 比特深度(位)
    • 比特率(kbps)
    autio_path

    AutioInfo (获取音频信息, "get audio info") reads an audio file's technical metadata - duration, sample rate, channels, bit depth, bitrate - and hands them to your graph as numbers. It's the audio sibling of the pack's VideoInfo node, built on the same idea: a boring read-only utility that answers "what is this file, actually?" so the rest of your workflow can adapt.

    And note the spelling. AutioInfo, not AudioInfo - the same "autio" typo the pack bakes into AutioPath. Search "Autio" and you'll find both; that's deliberate naming on the author's part, or at least it is now.

    Why you'd reach for it: feeding a VideoInfo-style check to audio lets a workflow branch on quality - pick a different processing path for a 32kHz clip vs. a 44.1kHz one, verify a TTS output has the sample rate your video expects before mixing, or compute how much AudioBeforeAfterSilence padding a track needs to fill a time budget. It takes a path, not an AUDIO tensor, which is the important distinction: pair it with AutioPath (which gives you the path) and you can inspect files that were never loaded into the graph.

    How it works

    This one shells out to ffprobe - the ffmpeg companion - rather than parsing files in Python. It runs ffprobe -v quiet -print_format json -show_format -show_streams <path> and extracts the fields. It finds ffprobe by checking your PATH, then probing common Windows locations (D:\ffmpeg\bin, C:\ffmpeg\bin, and the portable ComfyUI's bundled ffmpeg/bin), falling back to a bare ffprobe call. So if ComfyUI's portable build has ffmpeg (it does), this works without you installing anything.

    Inputs and output

    • autio_path - a STRING path to an audio file.
    • Outputs, in order: 音频时长(秒) (duration, FLOAT seconds), 音频采样率 (sample rate, INT), 音频通道数 (channels, INT), 比特深度(位) (bit depth, INT), 比特率(kbps) (bitrate, INT kbps).

    Install

    In yanlang0123/ComfyUI_Lam - Manager search "ComfyUI_Lam", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yanlang0123/ComfyUI_Lam
    

    restart. No Python deps beyond the standard library - the requirement is ffprobe on the system, which the portable ComfyUI ships with. The README's install.bat requirement list is irrelevant here.

    Gotchas

    ffprobe must exist, or the node can't work - that's the one real environmental requirement, and it's usually satisfied automatically by portable ComfyUI. The path input has the same strictness as VideoInfo: real filesystem paths only, and the error for a missing file is explicit ("File does not exist"). Values come straight from ffprobe, so a compressed format like MP3 reports a variable bitrate or an approximate one - treat the bitrate output as "in the ballpark" for lossy files, exact for WAV/FLAC. And the duration for a variable-bitrate MP3 is computed by ffprobe from the container, which is accurate enough for nearly everything. It's a "read the specs and adapt" node - nothing more, nothing less, and it does that cleanly.

    Categorylam

    Inputs (1)

    NameTypeDefaultDescription
    autio_pathSTRING

    Outputs (5)

    NameTypeDescription
    音频时长(秒)FLOAT
    音频采样率INT
    音频通道数INT
    比特深度(位)INT
    比特率(kbps)INT