Nodes/comfyui-videototext/πŸŽ™οΈ Audio From Path
ComfyUI Node

πŸŽ™οΈ Audio From Path

The path-to-AUDIO bridge your ASR chain would be stuck without

By aadebugerΒ·Created 3 months agoΒ·Updated 3 months agoΒ· 0
πŸŽ™οΈ Audio From Path
    • audio
    • duration_sec
    • sample_rate
    β—„audio_pathβ€”β–Ί
    β—„target_sample_rate0β–Ί
    β—„force_monofalseβ–Ί

    Here's the gap this node exists to fill. ComfyUI's built-in LoadAudio only reads files from ComfyUI/input/. But VTT_ExtractAudio writes its WAV files to a temp directory (/tmp/comfyui_vtt/). So between "we extracted the audio" and "the ASR node will transcribe it" there's a mismatch: the transcription node wants a ComfyUI AUDIO dict, and the audio is sitting somewhere ComfyUI's own loader won't look. VTT_AudioFromPath is the bridge. Give it a path, and it hands back a proper AUDIO dict that MiMoASRTranscribe can eat - plus the duration and sample rate as a bonus.

    How it works

    Mechanically it's a thin torchaudio wrapper. It loads the file with torchaudio.load(), optionally flips it to mono by averaging the channels, optionally resamples to a target rate, then wraps the tensor in the {waveform, sample_rate} dict that ComfyUI's AUDIO type expects. It also computes the duration in seconds, which is genuinely useful - you can wire that number straight into the transcript JSON you build at the end of the chain.

    Three things worth knowing:

    • torchaudio is imported lazily, inside the node's load call. That's deliberate, but it means if torchaudio is missing you won't see an error at startup - you'll get RuntimeError: torchaudio is required the moment the workflow runs. Classic "looked fine in the graph editor, died on Execute."
    • target_sample_rate defaults to 0, meaning "keep the source rate" - the tooltip spells it out. Set it non-zero to resample, up to 48000. Since the extract node already hands you 16 kHz, you usually leave this alone.
    • force_mono defaults to false, because the extract step already made things mono. It's your safety net if you point this node at arbitrary audio files instead of the pipeline's own output.

    Inputs and output

    Only audio_path is required - a STRING, typically the audio_path output of VTT_ExtractAudio. The optional target_sample_rate and force_mono are the two dials above. The node then produces three outputs:

    • audio (AUDIO) - straight into MiMoASRTranscribe's audio input.
    • duration_sec (FLOAT) - into VTT_BuildTranscriptJSON for accurate metadata.
    • sample_rate (INT) - wherever you need it.

    That's one node doing all three jobs, which is why the middle of this graph looks so tidy.

    How to install it

    The pack install, plus one star dependency: torchaudio - the only thing in this pack's requirements.txt. Install it in ComfyUI's venv so it matches your torch build:

    cd ComfyUI && source .venv/bin/activate
    uv pip install torchaudio
    

    Then restart ComfyUI. ffmpeg isn't needed here - that's the previous node's job. The pack itself is MIT, and the genuinely heavy lifting (the MiMo model) lives in the companion ComfyUI-MiMoASR pack, which brings the 24 GB VRAM requirement and the transformers==4.49.0 pin that breaks Sonic and Qwen3TTS.

    Common issues

    FileNotFoundError if you hand it a stale or relative path - it checks existence before loading, which is good, but it means a typo stops the workflow loudly rather than quietly. And be a little patient with resampling on long files: the resampler runs on CPU, so a multi-hour lecture at a new sample rate takes a visible few seconds. That's not a bug, just physics.

    CategoryπŸŽ™οΈ VideoToText

    Inputs (3)

    NameTypeDefaultDescription
    audio_pathSTRINGβ€”
    target_sample_rateoptINT00–48000Resample to this rate if non-zero. 0 = keep source rate.
    force_monooptBOOLEANfalseβ€”

    Outputs (3)

    NameTypeDescription
    audioAUDIOβ€”
    duration_secFLOATβ€”
    sample_rateINTβ€”