
Sonicmatch
io.github.js713-lab由 GitHub 账号 js713-lab 发布v0.2.0更新于 Nov 3, 2026
Analyze video mood and pace, then recommend license-safe BGM with a mix spec.
概览
分析视频的情绪、节奏与语音,推荐授权安全的背景音乐,并给出钩子片段与 ffmpeg 闪避规格。
- 可以做什么
- 导入本地视频文件或 HTTPS 链接,返回资源标识而非视频本体
- 分析画面情绪、能量曲线、语音占比、场景切换、钩子窗口与 BPM
- 搜索、排序并查看曲目,每行都带授权与署名信息
- 试听混音:裁剪钩子、循环、闪避,并导出混音规格与 ffmpeg 命令
- 将剪辑点对齐节拍网格、保存品牌套件,并把最多 20 个片段聚类成共享歌单
- 适用场景
- 适合制作 Reels、Shorts 或商品短片等竖屏短视频时,让助手根据画面挑选背景音乐,并同时得到清晰的授权信息和可直接执行的混音方案。
- 运行要求
- 以本地 Python 3.10+ 包运行(uvx、pipx 或 python -m sonicmatch),需要 PATH 中有 ffmpeg 与 ffprobe。可选密钥:GEMINI_API_KEY 用于视频理解,JAMENDO_CLIENT_ID 与 FREESOUND_API_KEY 用于扩展曲库。无密钥时可用内置小型种子曲库。yt-dlp 平台链接导入默认关闭。
安装
在 SourceWeft 中
- 打开 控制台中的 Sonicmatch,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Sonicmatch
[CI] [PyPI] [License: MIT] [MCP Registry] [Python 3.10+]
Video-native MCP server for license-safe BGM. Watches the footage — not the script — and returns a shortlist, a 12–20s hook, and an ffmpeg ducking spec.
[Sonicmatch — video in, license-safe BGM out. Ingest, Analyze, Match, Mix.]
Package / CLI: sonicmatch-mcp. A Model Context Protocol server for Claude Desktop, Cursor, Codex, and other MCP clients. Drop an Instagram Reel, YouTube Short, or TikTok-style clip. Get royalty-free / Creative Commons matches with the license printed on every row.
Video-to-BGM already exists. The wedge is not “I also match music”:
- it watches the footage, not the script
- it returns a hook window + ffmpeg ducking spec
- it is agent-native
- it prints the license instead of lying
Catalog quality will kill or save this. More tools will not.
Do not treat this as “script in → YouTube Music search out.” That already exists (mcp-bgm-recommender). Sonicmatch watches the video.
North star: ingest_video → analyze_video_music → recommend_bgm → preview_mix → export_mix_spec
License warning (read this)
- The code is MIT.
- Every track has its own license. It is printed on every recommendation.
- Nothing here is an official Instagram sticker, TikTok Commercial Music Library track, or YouTube Audio Library API result.
- Do not recommend commercial pop unless the adapter is explicitly a user-owned licensed library.
- CC-BY still needs attribution. CC-BY-NC is not ok for ads / shops. Non-commercial tracks are never auto-recommended.
- For ads / shops, wire a user-owned Artlist / Epidemic JSON (
examples/user_library.example.json). Do not scrape those sites. - Content ID can still hit you if you point at the wrong source. A CC label is not a waiver.
Demo
I dropped
./clip.mp4. Analyze it for an Instagram Reel and recommend 5 instrumental BGMs. Then mix the top pick with ducking and give me the ffmpeg command.
That prompt is the product. Install below, wire Claude Desktop, Cursor, or Codex, and paste it.
Quick start
Requires Python 3.10+ and ffmpeg / ffprobe on PATH. yt-dlp is optional and off by default (SONICMATCH_ALLOW_YTDLP=0) because platform extractors break and may violate ToS. Prefer a local file.
The PyPI project is sonicmatch-mcp. The console script is sonicmatch-mcp, which is what uvx and pipx run. python -m sonicmatch is the same server. The PyPI badge stays empty until the first tag is published. Install from git until then. Maintainer steps: PUBLISH.md.
Works today (git)
After the first PyPI release
From a clone (editable + tests)
The seed catalog is about 20 Reel-editor rows (cafe, product, talking-head, travel, food, fashion, event) plus a vocal fixture and a CC-BY-NC fixture. It runs without API keys. Gemini, Jamendo, and Freesound are optional and degrade with a note in the tool response. Seed rows have no hosted audio on purpose — preview_mix synthesizes a demo bed. For real ads, point SONICMATCH_LIBRARY_PATH / EPIDEMIC_LIBRARY_PATH / ARTLIST_LIBRARY_PATH at JSON you already licensed.
Features
- Watches the picture. Gemini video understanding when
GEMINI_API_KEYis set; otherwise local ffmpeg / audio heuristics (optional Whisper, PySceneDetect, librosa). - License on every row. CC / royalty-free / user-owned library. Non-commercial tracks are never auto-recommended. Generated beds stay out of auto recs.
- Editor-shaped output. 12–20s hook in/out, speech ducking, ffmpeg recipe, mix spec for CapCut / Premiere / DaVinci / your agent.
- Agent-native MCP. stdio for Claude Desktop and Cursor; streamable HTTP for web editors. Never ships raw multi-MB video through the payload — you get an
asset_id. - Works without API keys. 20-track seed catalog for Reels. Optional Jamendo, Freesound, and user-owned Artlist / Epidemic JSON.
- Cuts on the beat.
suggest_cutssnaps scene cuts to a BPM grid and returns EDL-ish intro / peak / outro. - Brand lock. Save BPM / mood / no-vocals kits and pass
brand_kit=…intorecommend_bgm. - Series, not one-offs.
analyze_batch(max 20) clusters mood and returns one shared mini-playlist. - Honest about closed graphs. No fake “trending audio,” official IG stickers, or Content-ID-safe stamps. yt-dlp platform ingest is opt-in.
Tools
Also ships a prompt template: “Score this video like an IG music sticker.”
Product rules (Instagram-like, not Instagram)
- Prefer instrumental when
speech_coverage > 0.25 - Recommend a hook window, not the whole song
- Show why (
cuts at 0.8s average, 112 BPM, warm gold hour) - Always return license + attribution text
- 3–7 tracks, not 40
- User can override mood / genre / no-lyrics / platform / energy
- Never claim “cleared for Instagram official sticker” unless it actually is
Example
Prompt:
I dropped
./clip.mp4. Analyze it for an Instagram Reel and recommend 5 instrumental BGMs. Then mix the top pick with ducking and give me the ffmpeg command.
The agent should call, in order:
ingest_videowith the local path. The result is anasset_id, not video bytes.analyze_video_musicwithplatform_hintset toinstagram_reel.recommend_bgmwith thatasset_idandmax_resultsof 5.preview_mixon the top track with ducking, thenexport_mix_spec.
A recommendation row carries score, reason, suggested_in_out (the hook), ducking, license_ok_for_platform, and content_id_risk (unknown or likely, never cleared). Seed fixtures include seed_golden_hour_latte (CC0-1.0) and seed_indie_porch_110 (CC-BY-4.0). They have no hosted audio. preview_mix synthesizes a demo bed. CC-BY-NC rows are searchable and are not auto-recommended.
Claude Desktop
claude_desktop_config.json. From git, no clone:
After a clone, command can be the absolute path of .venv/bin/sonicmatch-mcp. After the PyPI release, args is just ["sonicmatch-mcp"]. Copy-paste files: examples/claude_desktop.mcp.json, examples/claude_desktop.pypi.mcp.json.
Cursor
.cursor/mcp.json (project) or ~/.cursor/mcp.json. From git, no clone — examples/cursor.mcp.json:
After PyPI, use examples/cursor.pypi.mcp.json (uvx with args ["sonicmatch-mcp"]). From a clone: "command": "uv", "args": ["--directory", "/absolute/path/to/sonic-match-mcp", "run", "sonicmatch-mcp"]. After pip install, "command": "python3", "args": ["-m", "sonicmatch"] works if that interpreter has the package.
Codex
Codex reads ~/.codex/config.toml. The same file is shared with the Codex IDE extension and the ChatGPT desktop app. Works today — examples/codex.config.toml:
Or from the CLI:
After the PyPI release, the args shrink to sonicmatch-mcp. That file is examples/codex.pypi.config.toml:
codex mcp list should show sonicmatch. A trusted project can use .codex/config.toml instead of the home file.
User-owned Epidemic/Artlist JSON shape: examples/user_library.example.json. Registry metadata: server.json. HTTP editors can point at http://127.0.0.1:8765/mcp after sonicmatch-mcp --http.
Hosted (sonic.codecrafter.dev)
The GitHub repo stays MIT. Running it yourself is not metered.
The public endpoint charges credits per tool call. A trial key is 25 credits. Pack prices: Reel 500 credits / $9, Studio 3000 credits / $39. Card checkout is not connected on the host yet.
The landing page is https://sonic.codecrafter.dev. Use Use the sample clip there, or download examples/sample-clip.mp4 and upload it, to try a match without your own footage.
- Open https://sonic.codecrafter.dev and take a trial key (or use a paid key).
export SONICMATCH_API_KEY=sm_…- Add to Cursor: the button on that page, or paste
examples/cursor.hosted.mcp.jsoninto~/.cursor/mcp.json.
--http has no authentication. Keep it on loopback. The Docker image binds 0.0.0.0 so the container port works — do not publish that port to the internet. See SECURITY.md.
Architecture
Hard rule: never send raw multi-MB video through the MCP payload. Store locally, pass an asset_id. Loopback, file://, and private IPs are rejected (SSRF).
VideoSonic profile
Analysis returns structured JSON, not a paragraph:
- Primary: Gemini video understanding when
GEMINI_API_KEYis set. - Fallback: ffmpeg scene cuts + WAV energy / silence / ZCR heuristics. Optional
faster-whisper,scenedetect,librosaif installed (pip install 'sonicmatch-mcp[local-vl]').
Music hub
Pluggable, license-first. v0 ships:
Ranking (weighted): mood/energy → instrumental if speech → duration/loop → BPM vs cut rate → license fit → tag embedding cosine → user constraints. recommend_bgm drops non-commercial and generated tracks instead of downranking them.
Tracks are indexed in SQLite (~/.cache/sonicmatch-mcp/db/tracks.sqlite) with a 24-d tag embedding. If lancedb is installed (pip install 'sonicmatch-mcp[embeddings]'), vectors are also upserted there.
Seed tracks have no remote audio files on purpose (you should host files you actually have the rights to). preview_mix synthesizes a CC0 demo bed so the mixer still runs offline. generate_bed is a catalog-miss fallback and is not cleared for ads.
Docker
Roadmap
Catalog > new tools.
- Freesound adapter (loops / beds)
- Tag embeddings in SQLite (+ optional LanceDB extra)
- Epidemic Sound / Artlist as user-owned JSON plugins (no scrape)
- Beat-grid vs scene-cut suggestions (EDL-ish
suggest_cuts) - MCP registry listing (
server.json) - Generate tool, marked
source=generated(local demo; swap a real model at your own legal risk) - Official MCP registry listing via GitHub Release MCPB (see PUBLISH.md)
- Non-commercial licenses excluded from auto
recommend_bgm - 20 seed beds a Reel editor would actually keep, with audio you host
- User-owned Artlist / Epidemic JSON as the default path for ads
- Real CLAP audio embeddings
- PyPI project metadata, console script, and tag-triggered Trusted Publishing (
.github/workflows/release.yml) - First upload on PyPI (
uvx sonicmatch-mcp). Maintainer steps are in PUBLISH.md. The name was unregistered as of 2026-10-21.
Why this can be a good open-source project
Yes if you nail: (1) video-native analysis, (2) license honesty on every row, (3) editor-shaped output (hook in/out, ducking, mix spec), (4) a catalog someone would keep.
No if you only wrap YouTube Music search, or if the first five recs sound like leftover stock beds.
Day-1 risk gates (enforced in code, not slogans):
Use cases
IG Reel / Story · Shopee product clip · YouTube Shorts agent · CapCut/Premiere companion · campus recap · podcast clipper · travel-vlog batch · brand-kit lock (BPM + no vocals) · silent-film / accessibility · multi-agent studio.
Contributing
CONTRIBUTING.md · CODE_OF_CONDUCT.md · SECURITY.md · CHANGELOG.md · starter issues
License
MIT. Track licenses are independent of the repo license.
From CodeCrafter.
来源:README.md,提交 290c95c
工具
0版本历史
1- v0.2.0最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分