deezer/spleeter · error · SpleeterError
output directory does not exists: {directory}
Error message
output directory does not exists: {directory} What it means
`FFMPEGAudioAdapter.save` computes the parent directory of the target path and raises a `SpleeterError` if that directory does not exist. ffmpeg subprocesses cannot create directories, so spleeter fails fast before writing.
Source
Thrown at spleeter/audio/ffmpeg.py:165
data (np.ndarray):
Waveform data to write.
sample_rate (float):
Sample rate to write file in.
codec (Codec):
(Optional) Writing codec to use, default to `None`.
bitrate (str):
(Optional) Bitrate of the written audio file, default to
`None`.
Raises:
IOError:
If any error occurs while using FFMPEG to write data.
"""
if isinstance(path, Path):
path = str(path)
directory = os.path.dirname(path)
if not os.path.exists(directory):
raise SpleeterError(f"output directory does not exists: {directory}")
logger.debug(f"Writing file {path}")
input_kwargs = {"ar": sample_rate, "ac": data.shape[1]}
output_kwargs = {"ar": sample_rate, "strict": "-2"}
if bitrate:
output_kwargs["audio_bitrate"] = bitrate
if codec is not None and codec != "wav":
output_kwargs["codec"] = self.SUPPORTED_CODECS.get(codec, codec)
process = (
ffmpeg.input("pipe:", format="f32le", **input_kwargs)
.output(path, **output_kwargs)
.overwrite_output()
.run_async(pipe_stdin=True, pipe_stderr=True, quiet=True)
)
try:
process.stdin.write(data.astype("<f4").tobytes())
process.stdin.close()
process.wait()
except IOError:View on GitHub (pinned to c8854001ac)
Solutions
- Create the output directory before saving: `os.makedirs(directory, exist_ok=True)`
- Or pass a `filename_format`/path inside an already-existing directory
- Double-check the output path for typos and relative/absolute path mixups
Example fix
// before
separator.separate_to_file('song.mp3', 'output/vocals_only/song.wav')
// after
import os
os.makedirs('output/vocals_only', exist_ok=True)
separator.separate_to_file('song.mp3', 'output/vocals_only/song.wav') Defensive patterns
Strategy: validation
Validate before calling
import os out = 'output/vocals_only/song.wav' os.makedirs(os.path.dirname(out) or '.', exist_ok=True)
Try / catch
try:
separator.separate_to_file('song.mp3', output_path)
except Exception as e:
if 'output directory does not exists' in str(e):
os.makedirs(output_path, exist_ok=True)
separator.separate_to_file('song.mp3', output_path)
else:
raise Prevention
- Always os.makedirs(output_dir, exist_ok=True) before separating
- Resolve output paths to absolute paths to avoid cwd surprises
- Check path spelling in config files and CLI arguments
When it happens
Trigger: Calling `separator.separate_to_file(..., output_path='newdir/sub/')` or `adapter.save(path, ...)` where the target directory (or any parent) has not been created yet.
Common situations: Writing separation output to a fresh output folder that was never created, typo in the output path, running from a different working directory than expected.
Related errors
- {} binary not found
- An error occurs with ffprobe (see ffprobe output below) {}
- FFMPEG error: {process.stderr.read()}
- Configuration file {descriptor} not found
AI-assisted analysis of deezer/spleeter@c8854001ac (2026-08-28).
Data as JSON: /api/errors/f1fae2a1e19a79e2.
Report an issue: GitHub.