Demucs
Use demucs to split music into stems (default: vocals, drums, bass, other).
Quick start
- - Help: INLINECODE5
- Basic split: INLINECODE6
- Output dir: INLINECODE7
- Vocals only pair: INLINECODE8
Prerequisites
- - Demucs available:
demucs --help or absolute path like D:\demucs-agent-tool\venv\Scripts\demucs.exe --help. - FFmpeg available:
ffmpeg -version must succeed. - Note:
ffmpeg-python is only a Python wrapper and does not install ffmpeg.exe.
Common options
- - Model:
-n htdemucs (default) or other installed model names. - Device:
-d cuda or -d cpu. - Chunking:
--segment 8 --overlap 0.25 to reduce VRAM/RAM pressure. - No chunking:
--no-split for short audio with enough memory. - Equivariant shifts:
--shifts 1..10 (higher quality, slower). - Parallel jobs:
-j 2 (or more on strong CPUs).
Output format
- - Default output is WAV.
- FLAC: INLINECODE21
- MP3: INLINECODE22
- Safer clipping behavior:
--clip-mode rescale (default) or --clip-mode clamp.
Naming and folder layout
- - Default output path pattern:
separated/<model>/<track>/<stem>.<ext>. - Customize names:
--filename "{track}/{stem}.{ext}". - Variables supported:
{track}, {trackext}, {stem}, {ext}.
Batch usage
- - Multiple files in one call:
demucs "a.mp3" "b.wav" "c.flac" -o "D:\\separated". - Prefer absolute paths for automation scripts and scheduled jobs.
Windows notes
- - In venv, executable is usually
venv\\Scripts\\demucs.exe. - Use quoted paths when spaces exist:
demucs "D:\\My Music\\song.mp3". - For external programs, prefer absolute executable path instead of shell activation.
- If non-ASCII paths cause tool/runtime issues, copy input to a temporary ASCII path and run Demucs there.
Troubleshooting
- -
demucs not found: run python -m demucs --help or call venv\\Scripts\\demucs.exe directly. - INLINECODE37 /
ffprobe not found: install FFmpeg and add it to PATH, then verify with ffmpeg -version. - Out of memory: lower
--segment (for example 6 or 4), set -d cpu, or process fewer tracks at once. - Slow speed on CPU: reduce
--shifts, keep chunking enabled, and tune -j. - Install/network failures: use a stable mirror and longer timeout when running pip.
Demucs
使用 demucs 将音乐分割成音轨(默认:人声、鼓、贝斯、其他)。
快速开始
- - 帮助:demucs --help
- 基本分割:demucs input.mp3
- 输出目录:demucs input.mp3 -o D:\\output
- 仅提取人声:demucs input.mp3 --two-stems vocals
前置条件
- - Demucs 可用:demucs --help 或使用绝对路径如 D:\demucs-agent-tool\venv\Scripts\demucs.exe --help。
- FFmpeg 可用:ffmpeg -version 必须执行成功。
- 注意:ffmpeg-python 仅是 Python 封装,不会安装 ffmpeg.exe。
常用选项
- - 模型:-n htdemucs(默认)或其他已安装的模型名称。
- 设备:-d cuda 或 -d cpu。
- 分块处理:--segment 8 --overlap 0.25 以减少显存/内存压力。
- 不分块:--no-split 适用于内存充足时的短音频。
- 等变平移:--shifts 1..10(质量更高,速度更慢)。
- 并行任务:-j 2(在强CPU上可设置更多)。
输出格式
- - 默认输出为 WAV。
- FLAC:demucs input.mp3 --flac
- MP3:demucs input.mp3 --mp3 --mp3-bitrate 320 --mp3-preset 2
- 更安全的裁剪行为:--clip-mode rescale(默认)或 --clip-mode clamp。
命名与文件夹布局
- - 默认输出路径模式:separated/<模型>/<曲目>/<音轨>.<扩展名>。
- 自定义名称:--filename {track}/{stem}.{ext}。
- 支持的变量:{track}、{trackext}、{stem}、{ext}。
批量使用
- - 单次调用多个文件:demucs a.mp3 b.wav c.flac -o D:\\separated。
- 自动化脚本和计划任务建议使用绝对路径。
Windows 注意事项
- - 在虚拟环境中,可执行文件通常位于 venv\\Scripts\\demucs.exe。
- 路径包含空格时使用引号:demucs D:\\My Music\\song.mp3。
- 对于外部程序,建议使用绝对可执行路径而非激活 shell。
- 如果非ASCII路径导致工具/运行时问题,可将输入复制到临时ASCII路径后运行 Demucs。
故障排除
- - demucs 未找到:运行 python -m demucs --help 或直接调用 venv\\Scripts\\demucs.exe。
- FFmpeg is not installed / ffprobe not found:安装 FFmpeg 并添加到 PATH,然后用 ffmpeg -version 验证。
- 内存不足:降低 --segment(例如 6 或 4),设置 -d cpu,或一次处理更少的曲目。
- CPU 速度慢:减少 --shifts,保持分块启用,并调整 -j。
- 安装/网络失败:运行 pip 时使用稳定镜像和更长的超时时间。