Comfy-Org/ComfyUI · error · ValueError
No audio stream found in the file.
Error message
No audio stream found in the file.
What it means
The load() helper uses PyAV and requires at least one audio stream; af.streams.audio is empty for video-only files, music-less MP4s, or files PyAV cannot map an audio stream in, so it raises before attempting decode.
Source
Thrown at comfy_extras/nodes_audio.py:336
return IO.NodeOutput(audio, ui=UI.PreviewAudio(audio, cls=cls))
save_flac = execute # TODO: remove
def f32_pcm(wav: torch.Tensor) -> torch.Tensor:
"""Convert audio to float 32 bits PCM format."""
if wav.dtype.is_floating_point:
return wav
elif wav.dtype == torch.int16:
return wav.float() / (2 ** 15)
elif wav.dtype == torch.int32:
return wav.float() / (2 ** 31)
raise ValueError(f"Unsupported wav dtype: {wav.dtype}")
def load(filepath: str) -> tuple[torch.Tensor, int]:
with av.open(filepath) as af:
if not af.streams.audio:
raise ValueError("No audio stream found in the file.")
stream = af.streams.audio[0]
sr = stream.codec_context.sample_rate
n_channels = stream.channels
frames = []
length = 0
for frame in af.decode(streams=stream.index):
buf = torch.from_numpy(frame.to_ndarray())
if buf.shape[0] != n_channels:
buf = buf.view(-1, n_channels).t()
frames.append(buf)
length += buf.shape[1]
if not frames:
raise ValueError("No audio frames decoded.")
View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Verify with ffprobe that the file contains an audio stream
- Re-mux/re-encode to include audio or extract audio first (ffmpeg -i in.mp4 -vn -c:a flac out.flac)
- If the codec is unsupported, install an FFmpeg/PyAV build with that codec enabled
- For silent videos, supply audio from another source instead of loading this file
Defensive patterns
Strategy: validation
Validate before calling
import av
def has_audio_stream(path: str) -> bool:
with av.open(path) as c:
return len(c.streams.audio) > 0 Try / catch
try:
wav, sr = load(path)
except ValueError as e:
if 'No audio stream' in str(e):
supply_audio_from_alternate_source()
else:
raise Prevention
- Pre-screen files with ffprobe/PyAV for an audio stream before loading
- Standardize inputs to known audio containers (wav/flac)
- Extract audio with ffmpeg -vn when processing video files
When it happens
Trigger: Calling load() on an MP4/MKV with only a video stream, a corrupted container where the audio track is unrecognized, or a file extension mismatch (video content renamed .wav).
Common situations: Pointing LoadAudio at a video file that has no audio; partially downloaded files; containers whose audio codec is unsupported by the installed FFmpeg build.
Related errors
- Expected waveform tensor shape (1, channels, samples)
- Unsupported wav dtype: {wav.dtype}
- No audio stream found in response.
- Decoded zero audio frames.
- No audio frames decoded.
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/944b319ed76b3ea3.
Report an issue: GitHub.