{"record":{"id":"734859cf20230c4c","repo":"deezer/spleeter","slug":"an-error-occurs-with-ffprobe-see-ffprobe-output-b","errorCode":null,"errorMessage":"An error occurs with ffprobe (see ffprobe output below)\n\n{}","messagePattern":"An error occurs with ffprobe \\(see ffprobe output below\\)\n\n(.+?)","errorType":"exception","errorClass":"SpleeterError","httpStatus":null,"severity":"error","filePath":"spleeter/audio/ffmpeg.py","lineNumber":103,"sourceCode":"            dtype (bytes):\n                (Optional) Data type to use, default to `b'float32'`.\n\n        Returns:\n            Signal:\n                Loaded data a (waveform, sample_rate) tuple.\n\n        Raises:\n            SpleeterError:\n                If any error occurs while loading audio.\n        \"\"\"\n        if isinstance(path, Path):\n            path = str(path)\n        if not isinstance(path, str):\n            path = path.decode()\n        try:\n            probe = ffmpeg.probe(path)\n        except ffmpeg._run.Error as e:\n            raise SpleeterError(\n                \"An error occurs with ffprobe (see ffprobe output below)\\n\\n{}\".format(\n                    e.stderr.decode()\n                )\n            )\n        if \"streams\" not in probe or len(probe[\"streams\"]) == 0:\n            raise SpleeterError(\"No stream was found with ffprobe\")\n        metadata = next(\n            stream for stream in probe[\"streams\"] if stream[\"codec_type\"] == \"audio\"\n        )\n        n_channels = metadata[\"channels\"]\n        if sample_rate is None:\n            sample_rate = metadata[\"sample_rate\"]\n        output_kwargs = {\"format\": \"f32le\", \"ar\": sample_rate}\n        if duration is not None:\n            output_kwargs[\"t\"] = str(dt.timedelta(seconds=duration))\n        if offset is not None:\n            output_kwargs[\"ss\"] = str(dt.timedelta(seconds=offset))\n        process = (","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/deezer/spleeter/blob/c8854001ac8acad34a9bc2bd15f28475541828b1/spleeter/audio/ffmpeg.py#L85-L121","documentation":"During `FFMPEGAudioAdapter.load`, the file is inspected with `ffmpeg.probe()` (ffprobe). If ffprobe fails on the file, the underlying `ffmpeg._run.Error` is wrapped in a `SpleeterError` that embeds ffprobe's stderr output, so the actual cause is in the attached message.","triggerScenarios":"Calling `adapter.load(path)` where ffprobe exits non-zero: nonexistent file, unreadable/corrupt file, unsupported or unrecognized format, permission errors.","commonSituations":"Passing a URL or path that 404s, truncated downloads, files with wrong extensions/container formats, DRM-protected or zero-byte files.","solutions":["Read the embedded ffprobe stderr in the error message to identify the root cause","Verify the file exists, is readable, and is a valid media file: `ffprobe <path>` outside spleeter","Re-download or re-encode the file if it is corrupt or truncated"],"exampleFix":"# before\naudio, sr = adapter.load('/data/song.mp3')  # file missing\n# after\nimport os\nassert os.path.isfile('/data/song.mp3')\naudio, sr = adapter.load('/data/song.mp3')","handlingStrategy":"validation","validationCode":"import os, subprocess\ndef probe_ok(path) -> bool:\n    if not os.path.isfile(path):\n        return False\n    return subprocess.run(['ffprobe', str(path)], capture_output=True).returncode == 0\nif not probe_ok('song.mp3'):\n    raise ValueError(f'ffprobe cannot read song.mp3')","typeGuard":null,"tryCatchPattern":"try:\n    audio, rate = adapter.load(path, offset=0, duration=30)\nexcept Exception as e:\n    if 'An error occurs with ffprobe' in str(e):\n        logger.error('ffprobe failed on %s: %s', path, str(e))\n        audio = None  # or fall back to another file\n    else:\n        raise","preventionTips":["Run ffprobe directly on files before batch processing","Validate file sizes and formats after download; discard 0-byte/truncated files","Use consistent, well-formed audio containers (wav/mp3) produced by ffmpeg"],"tags":["ffmpeg","file-io","invalid-media","ffprobe"],"backgroundTag":"ffprobe-failed-on-file","analyzedSha":"c8854001ac8acad34a9bc2bd15f28475541828b1","analyzedAt":"2026-08-28T21:38:40.142Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}