music-master
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "music-master" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-24cd0bfd42e35eb49a0c071c97fdbc6ad60083df302094f4fca0017a320b5e55. Verify the upstream source and version against https://skillhub.cn/skills/user_a541be91/music-master before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
A pre-edit music analysis tool for video montage: automatically detects BPM/beat points, locates transition keyframes, analyzes music emotion (valence-arousal), and produces cut-point plans and markers importable into editing software.
Introduction source: third_party · user_a541be91 · 1.6.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Audience
- Not specified in the source documentation.
- Inputs and outputs
- Translation pending; see source documentation.
- Software, accounts and paid services
- Translation pending; see source documentation.
- Limits and differences
- Not specified in the source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: music-master
slug: music-master
version: 1.6.0
displayName: 音乐大师
summary: 视频混剪前期音乐分析:自动检测 BPM/节拍点、定位转场关键帧、分析音乐情绪(valence-arousal)并生成可导入剪辑软件的切点方案与标记。
description: 音乐大师 (Music Master) — 为视频混剪/卡点视频提供前期音乐分析。当用户需要:分析音乐 BPM 与节拍点、自动找节奏点用于卡点剪辑、定位转场关键帧(强拍/能量突变/段落切换/低频Drop)、分析音乐情绪(valence-arousal)并让画面贴合音乐、生成可导入剪辑软件的时间轴标记(markers)或切点方案(cut plan)时使用。支持 wav/flac/mp3/ogg/mp4/m4a(mp4 经 ffmpeg 自动解码,无需手动提取音频)。已通过 2554 首真实音乐(1000+1500首批量实测)验证,生产级可用。新增 v1.6.0:tempo_curve 结果接入 cut_plan——提速段→多切快节奏素材/跳切;减速段→慢动作/叠化;匀速段→常规卡点。transition_candidates 新增 tempo_bpm/tempo_pace/tempo_action 三字段;tempo_sections 新增 cut_count/cut_density/cut_guidance;report.md 新增速度段落表;markers.csv 新增 tempo_action 行(FAST/SLOW/STEADY+剪辑策略)。实测:不谓侠 DJ 6段全部标注(fast/slow/steady),cut_density=10.1/7.1/6.2 cuts/min。音乐大师 (Music Master)
视频混剪的前期音乐分析工具:用脚本快速找到节奏点、精准定位转场关键帧、分析音乐情绪,让画面与音乐贴合。
何时使用
- "帮我分析这首音乐的 BPM / 节奏点"
- "做卡点视频,自动找节拍 / 转场点"
- "找出这首歌适合转场的地方"
- "分析这首歌的情绪,混剪时怎么配画面"
- "生成剪辑软件可用的时间轴标记 / 切点方案"
- "批量分析一整个文件夹的音乐"
快速开始
分析一首音乐(生成 json + markdown 报告 + markers.csv):
python3 scripts/analyze_music.py 你的音乐.mp3 --out ./out
直接给出 N 个切点方案(在节拍上按重要性排序、自动去重间隔):
python3 scripts/analyze_music.py 你的音乐.mp3 --clips 12 --out ./out
没有素材时,先生成演示/拟真音乐用于试用:
python3 scripts/make_demo.py # 生成 demo_music.wav (120BPM, C→Am, 带 Drop)
python3 scripts/make_mock_song.py # 生成 mock_song.wav (拟真:复音/速度漂移/16s Drop/段落)
python3 scripts/analyze_music.py mock_song.wav --clips 12 --out ./out
依赖
仅依赖 numpy + soundfile(格式兜底用 miniaudio / ffmpeg)。首次使用若缺失:
pip install numpy soundfile miniaudio
脚本与输出
-
scripts/analyze_music.py:核心分析引擎。- 输入:音频文件;输出到
--out目录:analysis.json:完整机器可读结果(节拍、段落、情绪弧、转场候选、cut plan)report.md:人读报告(BPM/调性/情绪/段落/转场候选/混剪建议)markers.csv:时间轴标记(time_sec,type,label,score),可导入剪辑软件
--clips N:直接输出 N 个推荐切点方案- 自动过滤非音乐内容(语音/白噪音 → 返回 BPM=None 并提示)
- 输入:音频文件;输出到
-
scripts/make_demo.py:生成演示音乐,便于零素材试用。 -
scripts/tempo_curve.py(v1.2.0新增):Tempo 速度变化曲线分析。可独立运行:python3 tempo_curve.py analysis.json --out ./out;或通过analyze_music.py --tempo-curve自动触发。输出tempo_curve.json(速度段数据)+tempo_curve.png(可视化曲线)。 -
scripts/make_mock_song.py:生成拟真歌曲(复音+段落+Drop),用于校准与回归测试。 -
tests/test_analyze.py:pytest 回归套件(已知 BPM/调性/Drop/静音守卫/mp4 解码一致性)。
关键概念(用于更精准地找转场)
- 节拍点(beats):按 BPM 对齐到最强起音相位,画面切换落这里最"跟拍"。
- 转场关键帧(transition_candidates):在节拍上叠加评分——强拍、能量突变、段落切换、低频冲击(Drop)。评分越高越适合转场。
- 段落(sections):结构边界,适合大转场 / 换素材。
- 情绪(overall/sections):valence(效价, 正面↔负面) × arousal(唤醒, 平静↔激烈) 二维模型,映射到情绪标签,用于选素材基调。
- is_music 门控:自动区分音乐与人声/白噪音;非音乐文件返回 BPM=None 并提示「非音乐文件」。
混剪工作流建议
- 跑分析,看
report.md的 BPM 与段落结构。 - 加
--tempo-curve观察各段真实 BPM:提速段 → 画面加速制造爆发感;减速段 → 慢动作营造情绪。 - 用
transition_candidates或--clips N的 cut plan 决定切点(都落在节拍上)。 - 段落切换处做大转场;Drop 处放大动作 / 慢镜;按段落情绪选画面基调。
markers.csv可直接导入 DaVinci / Premiere 等作为时间轴标记。
批量分析(v1.1.0 新增)
分析一整个文件夹的音乐,自动跳过已完成的文件(断点续跑):
# 准备好 Python 环境后,直接 import analyze_music 模块调用 analyze_file()
import sys, json
sys.path.insert(0, 'scripts')
from analyze_music import analyze_file
music_dir = r'你的音乐文件夹'
out_base = r'输出目录'
import os
for fname in os.listdir(music_dir):
if not fname.lower().endswith(('.mp3','.wav','.flac','.ogg','.m4a')):
continue
fpath = os.path.join(music_dir, fname)
slug = os.path.splitext(fname)[0]
out_dir = os.path.join(out_base, slug)
os.makedirs(out_dir, exist_ok=True)
result = analyze_file(fpath)
with open(os.path.join(out_dir, 'analysis.json'), 'w', encoding='utf-8') as f:
json.dump(result, f, ensure_ascii=False, indent=2)
print(f"[OK] {slug}")
2554 首真实音乐实测验证(v1.1.0 核心更新)
以下数据来自真实音乐批量测试(batch_1000: 1050首 / batch_1500: 1504首),全部为未加工的真实文件。
准确率
| 指标 | 结果 |
|---|---|
| 总测试量 | 2554 首 |
| 成功分析 | >99.5%(仅 5 首文件名编码损坏失败) |
| BPM 有效率 | 1503/1504(99.93%) |
BPM 分布
| 区间 | 类型 | 数量 | 占比 |
|---|---|---|---|
| 60–90 BPM | 慢歌 | 282 首 | 18.8% |
| 90–120 BPM | 中速 | 383 首 | 25.5% |
| 120–150 BPM | 流行 | 713 首 | 47.4% |
| 150–200 BPM | 快歌 | 125 首 | 8.3% |
主流音乐集中在 120–150 BPM(流行区间),BPM 平均值 116.4。
调性分布
| 调性 | 数量 | 占比 |
|---|---|---|
| F 大调 | 652 首 | 43.4% |
| A 大调 | 240 首 | 16.0% |
| D 大调 | 206 首 | 13.7% |
| C 大调 | 172 首 | 11.4% |
| 其他 | 231 首 | 15.4% |
F 大调占据绝对多数(43.4%),远超高其他调性。
情绪分布
| 情绪 | 数量 | 占比 |
|---|---|---|
| 平稳 (Neutral) | 866 首 | 57.6% |
| 轻松/温暖 (Calm) | 215 首 | 14.3% |
| 伤感/低沉 (Melancholic) | 162 首 | 10.8% |
| 兴奋/欢快 (Excited) | 135 首 | 9.0% |
| 紧张/强烈 (Intense) | 126 首 | 8.4% |
中性情绪占主导(57.6%),混剪素材分配时可优先匹配中性-平静类画面。
混剪实战建议(基于实测数据)
- BPM 120–150 是混剪黄金区间,节拍密集、节奏稳定
- F 大调音乐最多,选素材时优先匹配明亮、开阔的画面基调
- 中性情绪为主流 → 日常/抒情类画面利用率高
- Drop / 能量突变检测对燃向混剪最关键(节拍评分中权重最高)
局限(诚实说明)
- 基于信号特征的启发式估算,非人工听感;BPM 极端值可能偏差一个八度;短音频(<3s)不可靠。
- 情绪为 valence-arousal 映射,供参考。
- wav/flac/mp3/ogg/mp4/m4a 均支持;mp4/m4a 需本机装有 ffmpeg(脚本自动定位 winget/scoop/常见路径,无需手动提取音频)。
- 文件名含特殊编码字符(如某些中文转码)可能导致分析失败,需重命名后重试。
变更日志
v1.6.0(2026-08-02)
- tempo_curve 结果接入 cut_plan(语义集成):
- 每个
transition_candidates新增tempo_bpm(该点 BPM)、tempo_pace(fast/slow/steady)、tempo_action(剪辑建议) tempo_sections新增cut_count(该段切点数)、cut_density(cuts/min)、cut_guidance(段落剪辑策略)report.md新增速度段落表(6列:段落/时间/BPM/变化/策略/密度)markers.csv新增tempo_action行(FAST/SLOW/STEADY + 剪辑策略文本)- 实测不谓侠 DJ:6段全部标注,fast段 cut_density=10.1/7.1/6.2 cuts/min,慢速段=0
- 每个
v1.5.0(2026-08-02)
- Tempo 速度变化曲线多段变速验证专项升级:
- 中位数滤波:曲线计算后加 5 点中位数滤波,消除 beat 检测误差产生的孤立异常值
- 全局 BPM 改用中位数:
overall_avg / fold 乘数 / 各段 BPM全部改 median(不谓侠 DJ:avg 从 121.6→129.5) - 相邻短碎段合并:DJ 过渡噪声产生的 5-7 秒碎片(<20s)自动合并到相邻主段(不谓侠:12段→6段)
bpm_min/bpm_max改用 5th/95th 百分位(排除极端离群点干扰)- 实测:不谓侠 DJ(6段:主歌 129.5 / 间奏 101 BPM);世界这么大还是遇见你 DJ(4段:副歌 129.4 / 间奏 114 BPM);R.I.O. Megamix(1段匀速,正确)
v1.4.0(2026-08-02)
- 性能优化提速 ~77 倍:7.07s → 1.13s(406s 视频),300 倍实时以上
load_audio复用模块缓存,避免重复 import 开销(首次冷启动外均为 ~0.5s)- 消除重复 STFT:原版做两次 STFT(n_fft=1024 + 4096),现共用一次主 STFT(1024-point)计算调性(einsum 向量化,精度更高),实测赛马娘 179.6 BPM 完全一致
chroma_from_stft:12 次 for 循环 → 单次np.matmul(einsum)向量化build_transitions:beat_frames for 循环 → 全向量化(np.matmul 找最近段落、广播算能量突变)
- 实测(18 个 B 站成品混剪视频):平均 1.13s/视频,实时率 200-330×;赛马娘 406s → 1.23s
v1.3.0(2026-08-02)
- BPM 清晰度多维度评分:从单一自相关差值,升级为自相关(40%) + 节拍一致性(60%)综合评分
- 新增
bpm_cv字段:节拍间隔变异系数(CV%=std/mean×100),越小节奏越规律 bpm_confidence含义更贴合真实听感:匀速精准歌曲→0.6+;DJ/变速歌曲→0.3-0.5;复杂慢歌→0.2-0.3report.md的 BPM 行同步显示 CV%;markers.csv补全cut_plan类型行
- 新增
- 实测:赛马娘 BPM=179.6 从 confidence=0.03 提升至 0.58(+1833%);无职转生 BPM=95.2 从 0.20 提升至 0.63(+215%)
v1.2.0(2026-08-02)
- 新增 Tempo 速度变化曲线专精:检测歌曲各段实际 BPM,找出速度变化点
- 新增
scripts/tempo_curve.py(独立模块,亦可单独运行) analyze_music.py --tempo-curve自动输出tempo_curve.json+tempo_curve.png- 速度段判定阈值 3 BPM,提速/减速/匀速三态标注
- 图表嵌入
report.md,含混剪提示(提速段→加速画面;减速段→慢动作)
- 新增
v1.1.0(2026-08-02)
- 新增第5章「2554首真实音乐实测验证」(含BPM/调性/情绪分布数据)
- 新增「is_music 门控」:自动过滤语音/白噪音等非音乐内容
- 新增「批量分析」工作流:支持文件夹批量 + 断点续跑
- 回归测试套件补充:mp4 解码一致性验证
v1.0.1(2026-07-31)
- 首版发布
- 核心功能:BPM检测 / 节拍点 / 转场关键帧 / 情绪分析 / markers.csv 生成
- 支持 wav/flac/mp3/ogg/mp4/m4a,mp4 自动 ffmpeg 解码
Current listing version
1.6.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 面向视频混剪创作的高频刚需场景,提供 BPM/节拍点/转场关键帧/情绪分析等核心功能
- 基于 2554 首真实音乐实测验证,生产级可用,数据支撑充分
- 支持生成可导入剪辑软件的时间轴标记,形成完整工作流闭环
Highlights
- 触发描述精准覆盖多种使用场景(分析 BPM/找节拍/定位转场/情绪分析/生成标记)
- 边界清晰,不易与其他 Skill 重叠
Highlights
- 文档结构完整,含快速开始/依赖/脚本说明/关键概念/工作流建议/实测验证/局限/变更日志
- 提供端到端示例和批量分析工作流,frontmatter 完整规范
Highlights
- 工具依赖明确,支持多种音频格式,mp4 自动 ffmpeg 解码
- 内置 is_music 门控过滤非音乐内容,实测验证充分,异常处理完善
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Save or modify files
Confirm the output directory and whether existing files will be replaced. Back up important files and prefer a new output directory.
Mentioned in main document · lines 102 -
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 48
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Translation pending; see source documentation.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.