lov-ncm2mp3
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese网易云 NCM 转 MP3 · NetEase NCM to MP3
Convert NetEase NCM to MP3 · NetEase NCM to MP3
把网易云音乐客户端下载的 解密成普通播放器能直接打开的音频:默认输出
MP3,写入标题、歌手、专辑和封面;FLAC 这类无损内容可以按原格式保留。输出与
源文件同名放在旁边,已经有效的结果自动跳过,之前转坏的结果自动替换。
.ncm新版网易云文件在封面区后面有一段预留填充, 与
都没有跳过它,转出来的是一整段噪声。本 Skill 的
解析按 taurusxin/ncmdump 的封面帧读法实现,并在写出前校验格式和时长,坏结果
不会落盘。细节见 。
ncmdump-py 1.1.6Johnserf-Seed/ncm2mp3 0.3.1references/ncm-format.mdDecrypt files downloaded by the NetEase Cloud Music client into audio that ordinary players can open directly: output
MP3 by default and write the title, artist, album, and cover art; lossless content such as FLAC can be preserved in its
original format. Outputs are placed next to the source file with the same name; valid existing results are skipped
automatically, while previously corrupted results are replaced automatically.
.ncmNewer NetEase files contain a reserved padding section after the cover-art area. Neither nor
skips it, resulting in an entire segment of noise. This Skill’s parser follows the cover-frame
reading approach of taurusxin/ncmdump and validates the format and duration before writing, so bad results are never written
to disk. See for details.
ncmdump-py 1.1.6Johnserf-Seed/ncm2mp3 0.3.1references/ncm-format.mdTriggers
Triggers
Activate when
Activate when
- “把这个 ncm 转成 mp3。”
- “网易云下载的歌在别的播放器里放不了。”
- “把网易云音乐下载目录里的 ncm 全部转一下,子文件夹也要。”
- “之前转出来的 mp3 打不开,帮我修一下。”
- “无损的保留 flac,不要转码。”
- “Convert these NCM files to MP3.”
- “Help me play the songs I downloaded from NetEase Cloud Music in any player.”
- “Convert this NCM file to MP3.”
- “Songs downloaded from NetEase won’t play in other players.”
- “Convert all NCM files in the NetEase Cloud Music download directory, including those in subfolders.”
- “The MP3 files converted earlier won’t play. Help me fix them.”
- “Keep lossless files as FLAC; don’t transcode them.”
- “Convert these NCM files to MP3.”
- “Help me play the songs I downloaded from NetEase Cloud Music in any player.”
Do not activate when
Do not activate when
- 要从网易云或其他平台下载歌曲、视频 → 不在本 Skill 范围;视频平台链接交给
lov-media-crawler - 普通音频互转(FLAC、WAV、M4A 转 MP3)或剪辑、降噪 → 直接用 ffmpeg 或对应媒体 Skill
- 要把音频转写成字幕或文字 →
lov-voice2srt - 要新建或修改 Finder 右键菜单本身 → (本 Skill 只提供被调用的命令)
lov-finder-action - 要批量分发、上传或售卖解密后的歌曲 → 拒绝;本 Skill 只服务用户对自己已下载曲目的个人格式转换
- The request is to download songs or videos from NetEase or other platforms → outside this Skill’s scope; hand video-platform links to
lov-media-crawler - The request is for ordinary audio conversion (FLAC, WAV, or M4A to MP3), editing, or noise reduction → use ffmpeg or the corresponding media Skill directly
- The request is to transcribe audio into subtitles or text →
lov-voice2srt - The request is to create or modify the Finder context menu itself → (this Skill only provides the command it invokes)
lov-finder-action - The request is to batch distribute, upload, or sell decrypted songs → refuse; this Skill only supports personal format conversion of songs the user has already downloaded
User Profile (cross-session)
User Profile (cross-session)
Every generated Skill is connected to the shared contract in
. Read the shared user, brand, workspace, preferences, and this
Skill's namespace at the start of every run. Keep the source
portable: resolved personal values belong in the shared profile, never here.
user-profile/v1skill.yamlskills.<skill_id>When the user directly states a durable preference or brand fact, persist it
through and report the saved profile path. Put
Skill-specific values under ; use or
for shared values. Do not persist inferred secrets or credentials.
See for the complete contract.
scripts/profile_store.pyrecords.<field>brand.<field>user.<field>references/user-profile.md本 Skill 读取的长期记录(都可选):
| 记录 | 含义 | 对应参数 |
|---|---|---|
| | |
| 固定输出目录,默认放在源文件旁边 | |
| | |
Every generated Skill is connected to the shared contract in
. Read the shared user, brand, workspace, and preference data, along with this
Skill’s namespace, at the start of every run. Keep the source
portable: resolved personal values belong in the shared profile, never here.
user-profile/v1skill.yamlskills.<skill_id>When the user directly states a durable preference or brand fact, persist it
through and report the saved profile path. Put
Skill-specific values under ; use or
for shared values. Do not persist inferred secrets or credentials.
See for the complete contract.
scripts/profile_store.pyrecords.<field>brand.<field>user.<field>references/user-profile.mdThe long-term records read by this Skill are all optional:
| Record | Meaning | Corresponding parameter |
|---|---|---|
| | |
| Fixed output directory; by default, placed next to the source file | |
| When | |
Skill Group Composition
Skill Group Composition
Read before deciding whether to invoke or
extend any adjacent capability. The record distinguishes optional upstream and
downstream handoffs from embedded Kit modules. Do not silently depend on a
sibling Skill that is not shipped with this source.
references/skill-composition.mdRead before deciding whether to invoke or
extend any adjacent capability. The record distinguishes optional upstream and
downstream handoffs from embedded Kit modules. Do not silently depend on a
sibling Skill that is not shipped with this source.
references/skill-composition.mdWorkflow (MANDATORY)
Workflow (MANDATORY)
You MUST follow these steps in order.
You MUST follow these steps in order.
Step 0: Resolve skill root, dependencies, and runtime context
Step 0: Resolve skill root, dependencies, and runtime context
- Use if the environment provides it.
SKILL_DIR - Otherwise infer the installed skill directory from the current skill context.
- 必须确认 、
scripts/ncm2mp3.py、scripts/profile_store.py、references/ncm-format.md均存在。references/skill-composition.md - 运行方式按优先级选择:
- 有 :
uv,依赖由脚本头部的 PEP 723 声明自动准备。uv run "$SKILL_DIR/scripts/ncm2mp3.py" ... - 没有 :
uv需能导入python3与Crypto;缺失时脚本会给出mutagen的提示,征得同意后再安装。python3 -m pip install pycryptodome mutagen
- 有
- 只有需要把 FLAC、M4A 等非 MP3 内容转成 MP3 时才要求 ;找不到时改用
ffmpeg或让用户安装。--format original - If a required resource is missing, name its expected relative path and stop before producing a partial result.
When running scripts manually:
bash
export SKILL_DIR="/path/to/lov-ncm2mp3"Resolve on every invocation. The precedence is current request,
project context, Skill-specific profile records, shared preferences, shared
brand/user profile, then safe defaults. A direct user statement about a durable
preference or brand fact should be saved with
using , followed by a concise saved-path report.
context.profilescripts/profile_store.py record--confirm- Use if the environment provides it.
SKILL_DIR - Otherwise infer the installed skill directory from the current skill context.
- You must confirm that ,
scripts/ncm2mp3.py,scripts/profile_store.py, andreferences/ncm-format.mdall exist.references/skill-composition.md - Select the execution method by priority:
- If is available:
uv; dependencies are prepared automatically by the PEP 723 declaration at the top of the script.uv run "$SKILL_DIR/scripts/ncm2mp3.py" ... - Without :
uvmust be able to importpython3andCrypto. If either is missing, the script will provide amutagenprompt; obtain the user’s consent before installing them.python3 -m pip install pycryptodome mutagen
- If
- is required only when FLAC, M4A, or other non-MP3 content must be converted to MP3. If it cannot be found, use
ffmpeginstead or ask the user to install it.--format original - If a required resource is missing, name its expected relative path and stop before producing a partial result.
When running scripts manually:
bash
export SKILL_DIR="/path/to/lov-ncm2mp3"Resolve on every invocation. The precedence is current request,
project context, Skill-specific profile records, shared preferences, shared
brand/user profile, then safe defaults. A direct user statement about a durable
preference or brand fact should be saved with
using , followed by a concise saved-path report.
context.profilescripts/profile_store.py record--confirmStep 1: Understand the requested outcome
Step 1: Understand the requested outcome
- 确认输入是 文件或包含
.ncm的文件夹;目录默认只看当前层,用户说 “子文件夹也要”时加.ncm。目录扫描自动忽略 macOS 在外置盘上生成的-r旁路文件。._*.ncm - 把用户话语直接映射到参数,不要先跑一遍再问:
- “转成 mp3 / 默认” → 不加参数
- “无损的保留 flac / 不要转码” → (网易云负载实际只有 MP3 与 FLAC;若遇到 M4A/OGG 也会原样保留,但不写标签)
--format original - “输出到某个目录” → (递归时保留子目录结构)
--output-dir <dir> - “别联网 / 离线” → (封面不在文件里时就不写封面)
--no-cover-download - “之前转的放不了 / 修复” → 默认命令即可:有效结果跳过,损坏结果替换
- “全部重新转、覆盖掉” →
--force
- 同名旧输出按三种情况处理:无法播放(例如旧工具转出的噪声)→ 直接替换,这正是
修复场景;有效且时长吻合 → 跳过;能播放但时长不符(用户自己的文件或被截断的
旧结果)→ 标为 不动它,向用户说明后由用户决定是否
conflict。--force - 会覆盖任何同名输出,只在用户明确要求重转时使用。
--force - 源文件 永远只读,不移动、不删除。
.ncm
- Confirm that the input is a file or a folder containing
.ncmfiles; by default, directory scanning only examines the current level. When the user says “include subfolders,” add.ncm. Directory scanning automatically ignores macOS-rsidecar files generated on external drives.._*.ncm - Map the user’s wording directly to parameters; do not run the command once just to ask:
- “Convert to MP3 / default” → add no parameter
- “Keep lossless files as FLAC / don’t transcode” → (actual NetEase payloads contain only MP3 and FLAC; if M4A or OGG is encountered, preserve it as-is but do not write tags)
--format original - “Output to a specific directory” → (preserve the subdirectory structure when recursing)
--output-dir <dir> - “Don’t use the network / offline” → (if the cover art is not embedded in the file, do not write it)
--no-cover-download - “Previously converted files won’t play / repair them” → the default command is sufficient: valid results are skipped and corrupted results are replaced
- “Convert everything again / overwrite” →
--force
- Handle old outputs with the same name in three cases: unplayable, such as noise produced by an older tool → replace them directly; this is the repair scenario. Valid and matching in duration → skip them. Playable but with a mismatched duration, such as the user’s own file or a truncated old result → mark them as and leave them untouched, explain the issue to the user, and let the user decide whether to use
conflict.--force - overwrites any output with the same name and should only be used when the user explicitly requests reconversion.
--force - Source files are always read-only and are never moved or deleted.
.ncm
Step 1.5: Analyze nearby Skills before implementation
Step 1.5: Analyze nearby Skills before implementation
- 先读 。本 Skill 只负责“NCM → 可播放音频”; Finder 右键入口由
references/skill-composition.md生成,它调用本 Skill 的命令行契约。lov-finder-action - 不要在这里做下载、剪辑、转写或上传。
- First read . This Skill is only responsible for “NCM → playable audio”; the Finder context-menu entry is generated by
references/skill-composition.md, which invokes this Skill’s command-line contract.lov-finder-action - Do not perform downloading, editing, transcription, or uploading here.
Step 2: Execute the workflow
Step 2: Execute the workflow
- 批量或不确定时先看计划:用与正式运行完全相同的参数,只多加 。 预演不写任何文件(包括日志与输出目录),缺 ffmpeg 等会导致正式运行失败的问题 在预演里同样报
--dry-run。failed
bash
uv run "$SKILL_DIR/scripts/ncm2mp3.py" ~/Music/网易云音乐 -r --format original --dry-run- 转换(输出放在源文件旁边):
bash
uv run "$SKILL_DIR/scripts/ncm2mp3.py" "许巍 - 蓝莲花.ncm"
uv run "$SKILL_DIR/scripts/ncm2mp3.py" ~/Music/网易云音乐 -r- 常见变体:
bash
undefined- For batch or uncertain requests, preview the plan first: use exactly the same parameters as the actual run and add only
. The dry run writes no files, including logs and output directories. Problems such as a missing
--dry-runthat would cause the actual run to fail are also reported asffmpeg.failed
bash
uv run "$SKILL_DIR/scripts/ncm2mp3.py" ~/Music/网易云音乐 -r --format original --dry-run- Convert the files, placing outputs next to the source files:
bash
uv run "$SKILL_DIR/scripts/ncm2mp3.py" "许巍 - 蓝莲花.ncm"
uv run "$SKILL_DIR/scripts/ncm2mp3.py" ~/Music/网易云音乐 -r- Common variants:
bash
undefined无损保留原格式(FLAC 仍是 FLAC,写 Vorbis 标签与封面)
Preserve lossless content in its original format (FLAC remains FLAC, with Vorbis tags and cover art)
uv run "$SKILL_DIR/scripts/ncm2mp3.py" album/ --format original
uv run "$SKILL_DIR/scripts/ncm2mp3.py" album/ --format original
输出到独立目录,结构化结果供后续统计
Output to a separate directory, with structured results for downstream statistics
uv run "$SKILL_DIR/scripts/ncm2mp3.py" in/ -r -o out/ --json
uv run "$SKILL_DIR/scripts/ncm2mp3.py" in/ -r -o out/ --json
离线,不下载封面
Offline mode; do not download cover art
uv run "$SKILL_DIR/scripts/ncm2mp3.py" song.ncm --no-cover-download
uv run "$SKILL_DIR/scripts/ncm2mp3.py" song.ncm --no-cover-download
给 Finder Quick Action 等无终端入口用:额外写一份日志
For headless entry points such as Finder Quick Actions: also write a log
uv run "$SKILL_DIR/scripts/ncm2mp3.py" "$@" --log ~/Library/Logs/ncm2mp3.log
4. 用户说出长期偏好时写回 Profile,例如“以后无损的都保留 flac”:
```bash
python3 "$SKILL_DIR/scripts/profile_store.py" record \
--skill-id lov-ncm2mp3 \
--path records.output_format \
--value '"original"' \
--confirmuv run "$SKILL_DIR/scripts/ncm2mp3.py" "$@" --log ~/Library/Logs/ncm2mp3.log
4. When the user states a long-term preference, write it back to the Profile, for example, “always preserve lossless files as FLAC”:
```bash
python3 "$SKILL_DIR/scripts/profile_store.py" record \
--skill-id lov-ncm2mp3 \
--path records.output_format \
--value '"original"' \
--confirmStep 3: Validate the deliverable
Step 3: Validate the deliverable
- 脚本自带门禁:解密后的文件头必须是 MP3/FLAC/M4A/OGG/WAV;写出后按磁盘上实际 存在的音频计算时长(MP3 用字节数与码率,其他格式用 ffmpeg 解复用),与网易云 记录相差超过 2%(至少 0.5 秒、至多 3 秒)即判失败,下载中断的文件因此不会被当成 完整文件;结果先写同目录隐藏临时文件,校验通过才原子替换,失败不留下任何输出。
- 每个输入一行:,最后一行是汇总。状态有
状态: 文件名 -> 输出路径 {详情 JSON}、converted(预演)、planned(已有有效输出)、skipped(同名文件 内容不同或同批次两个输入写同一输出)、conflict(非ignored)、.ncm。详情里failed是实测时长;duration为cover/embedded/downloaded/existing/none(预演);可能出现will download、replaces、transcode(无 ffmpeg 时非 MP3 输出未做完整性核对)。completeness: unchecked without ffmpeg - 退出码:0 全部成功或跳过;1 至少一个 或
failed;2 参数错误或日志 无法写入(此时不处理任何文件)。文本模式下conflict与failed行写 stderr,conflict模式全部在 JSON 里。首次运行时--json可能在 stderr 打印依赖安装信息。uv - 向用户报告:转换数、跳过数、失败数与原因、输出位置;抽查一个结果可用
或 macOS 的
ffprobe -v error -show_entries format=duration <file>。afplay -t 3 <file> - 失败原因的含义与处理见 的“故障对照”。同一原因不要原样重试。
references/ncm-format.md - 维护本 Skill 时(不是每次转换)校验可信记录与回归测试:
,
python3 "$SKILL_DIR/scripts/validate_skill.py" "$SKILL_DIR"。uv run --with pycryptodome --with mutagen python3 "$SKILL_DIR/tests/test_ncm2mp3.py"
- The script has built-in validation gates: the decrypted file header must be MP3, FLAC, M4A, OGG, or WAV. After writing, calculate the duration from the audio actually present on disk, using the byte count and bitrate for MP3 and ffmpeg demuxing for other formats. If the difference from the NetEase record exceeds 2%, with a minimum threshold of 0.5 seconds and a maximum threshold of 3 seconds, treat the result as a failure. Interrupted downloads therefore cannot be mistaken for complete files. The result is first written to a hidden temporary file in the same directory and atomically replaced only after validation passes, leaving no output on failure.
- Produce one line per input: , followed by a final summary line. Statuses include
status: filename -> output path {details JSON},converted(dry run),planned(a valid output already exists),skipped(a same-name file has different content or two inputs in the same batch map to the same output),conflict(notignored), and.ncm. In the details,failedis the measured duration;durationcan becover/embedded/downloaded/existing/none(during a dry run). Details may also containwill download,replaces, andtranscode(completeness was not verified for a non-MP3 output when ffmpeg was unavailable).completeness: unchecked without ffmpeg - Exit codes: 0 means all files succeeded or were skipped; 1 means at least one or
failed; 2 means invalid arguments or the log could not be written, in which case no files are processed. In text mode,conflictandfailedlines are written to stderr; inconflictmode, everything is included in the JSON. On the first run,--jsonmay print dependency installation information to stderr.uv - Report to the user: the number converted, skipped, and failed; the failure reasons; and the output location. Spot-check one result using or macOS’s
ffprobe -v error -show_entries format=duration <file>.afplay -t 3 <file> - See the “Troubleshooting” section in for failure meanings and handling. Do not retry the same cause unchanged.
references/ncm-format.md - When maintaining this Skill, rather than during every conversion, validate trusted records and regression tests using: , and
python3 "$SKILL_DIR/scripts/validate_skill.py" "$SKILL_DIR".uv run --with pycryptodome --with mutagen python3 "$SKILL_DIR/tests/test_ncm2mp3.py"
Dependencies
Dependencies
- Python 3.9+,与
pycryptodome(mutagen按脚本头部声明自动安装)uv run - FFmpeg:把 FLAC/M4A/OGG/WAV 转成 MP3 时必需;时用于核对 非 MP3 输出是否完整,缺失时照常输出并标注未核对
--format original - 网络:仅在 NCM 内没有封面时访问元数据里的网易云封面地址,可用 关闭
--no-cover-download - 无外部 Skill 依赖;交接见
references/skill-composition.md
- Python 3.9+, , and
pycryptodome(mutagenautomatically installs them according to the declaration at the top of the script)uv run - FFmpeg: required when converting FLAC, M4A, OGG, or WAV to MP3; with , it is used to verify whether non-MP3 outputs are complete. If it is unavailable, the output is still produced and marked as unchecked.
--format original - Network: used only to access the NetEase cover-art URL in the metadata when the NCM file contains no cover art; disable it with .
--no-cover-download - No external Skill dependencies; see for handoffs
references/skill-composition.md