{"record":{"id":"f424473cc85b1ece","repo":"Comfy-Org/ComfyUI","slug":"no-audio-frames-decoded","errorCode":null,"errorMessage":"No audio frames decoded.","messagePattern":"No audio frames decoded\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_audio.py","lineNumber":353,"sourceCode":"        if not af.streams.audio:\n            raise ValueError(\"No audio stream found in the file.\")\n\n        stream = af.streams.audio[0]\n        sr = stream.codec_context.sample_rate\n        n_channels = stream.channels\n\n        frames = []\n        length = 0\n        for frame in af.decode(streams=stream.index):\n            buf = torch.from_numpy(frame.to_ndarray())\n            if buf.shape[0] != n_channels:\n                buf = buf.view(-1, n_channels).t()\n\n            frames.append(buf)\n            length += buf.shape[1]\n\n        if not frames:\n            raise ValueError(\"No audio frames decoded.\")\n\n        wav = torch.cat(frames, dim=1)\n        wav = f32_pcm(wav)\n        return wav, sr\n\nclass LoadAudio(IO.ComfyNode):\n    @classmethod\n    def define_schema(cls):\n        input_dir = folder_paths.get_input_directory()\n        os.makedirs(input_dir, exist_ok=True)\n        files = folder_paths.filter_files_content_types(os.listdir(input_dir), [\"audio\", \"video\"])\n        return IO.Schema(\n            node_id=\"LoadAudio\",\n            search_aliases=[\"import audio\", \"open audio\", \"audio file\"],\n            display_name=\"Load Audio\",\n            category=\"audio\",\n            essentials_category=\"Audio\",\n            inputs=[","sourceCodeStart":335,"sourceCodeEnd":371,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_audio.py#L335-L371","documentation":"After a container reports an audio stream, load() iterates af.decode; if zero frames come back the frames list stays empty and torch.cat would fail, so the helper raises this explicit error. It indicates a header-only or truncated audio stream.","triggerScenarios":"Decoding a truncated/corrupted download where the stream header exists but no packets follow; audio streams with zero-length duration; DRM-protected content that decodes to nothing; seek-past-end before decode.","commonSituations":"Interrupted downloads, files copied while still being written, streaming recordings finalized without their index, or unusual codecs that PyAV opens but cannot decode with the bundled FFmpeg.","solutions":["Re-download or re-mux the file (ffmpeg -i in.flac out.flac) to rebuild packet structure","Verify the file plays in ffplay/VLC and has nonzero audio duration","Update PyAV/FFmpeg if the codec is nominally supported but yields no frames","Fall back to extracting audio via ffmpeg CLI and loading the result"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import av\n\ndef audio_stream_has_packets(path: str) -> bool:\n    with av.open(path) as c:\n        if not c.streams.audio:\n            return False\n        s = c.streams.audio[0]\n        return s.duration is None or s.duration > 0","typeGuard":null,"tryCatchPattern":"try:\n    wav, sr = load(path)\nexcept ValueError as e:\n    if 'No audio frames' in str(e):\n        wav, sr = load_via_ffmpeg_extract(path)  # ffmpeg -vn -acodec flac\n    else:\n        raise","preventionTips":["Verify downloads completed (size/hash) before processing","Re-mux suspicious files with ffmpeg to rebuild packet structure","Keep PyAV/FFmpeg current for exotic codec support"],"tags":["audio","pyav","decode","corrupt-file"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}