内容
<p align="center">
<img src="https://raw.githubusercontent.com/dhirajlochib/VidMcp/main/demos/samples/07_creator_polish.gif" width="640" alt="VidMCP 1.1 Creator polish" />
</p>
<h1 align="center">VidMCP</h1>
<p align="center">
<em>智能代理不描述视频,它们剪辑视频。</em>
</p>
<p align="center">
<a href="https://vidmcp.com"><img alt="官网" src="https://img.shields.io/badge/vidmcp.com-d4ff2a?style=flat-square&labelColor=050507&color=d4ff2a" /></a>
<a href="https://pypi.org/project/vidmcp/"><img alt="PyPI" src="https://img.shields.io/badge/PyPI-2affd1?style=flat-square&labelColor=050507" /></a>
<a href="https://dhirajlochib.com/"><img alt="作者" src="https://img.shields.io/badge/Dhiraj%20Lochib-b18cff?style=flat-square&labelColor=050507" /></a>
<img alt="Python" src="https://img.shields.io/badge/Python_3.11+-ffa24e?style=flat-square&labelColor=050507" />
<img alt="许可证" src="https://img.shields.io/badge/MIT-efefeb?style=flat-square&labelColor=050507" />
</p>
<p align="center">
<b>MCP 服务器</b> 用于智能代理视频编辑 — 背景抠图 · 主体背景特效 · 音频优化 · 字幕 · 导出<br/>
由 <a href="https://dhirajlochib.com/">Dhiraj Lochib</a> · <a href="https://vidmcp.com">vidmcp.com</a> · <code>uv tool install vidmcp</code> 构建
</p>
---
## 创作者优化流程
一键发布就绪的谈话头:
```text
方向调整 → 降噪 → 背景音乐 → 字幕 → 可选背景替换 → 导出预设
```
| 工具 | 功能 |
|------|----------------|
| `run_talking_head_polish` | 一键完成全部流程 |
| `process_audio` | 降噪 · 增益控制 · EQ · 响度归一化 |
| `mix_bgm` | 语音下背景音乐(ducking) |
| `transcribe_and_caption` | Whisper 语音识别 + 品牌水印 |
| `replace_background` | 背景抠图 + 空间 / 模糊 / 实色板 |
| `smart_cut_hesitations` | 删除静默 & 填充词 |
| `export_render` | `youtube_16x9` · `reels_9x16` · `square_1x1` |
| `import_video` | **自动纠正人像旋转** 默认直立 |
```python
from vidmcp.tools.creator import run_talking_head_polish
print(run_talking_head_polish(
"talk.mov",
preset="reels_9x16",
bg_mode="space", # none | space | blur | solid
strength=0.75,
bgm_volume=0.35,
))
```
MCP 代理还可以调用 `apply_recipe(..., recipe_name="talking_head_polish")` 或自由文本 `run_intent(...)`。
### 代理上下文(工具包 + 简洁结果)
当 MCP 主机加载 **~90 个工具模式** 和庞大的 JSON 数据时,代理会感到应接不暇。VidMCP 默认采用小范围的工具包:
| 设置 | 默认值 | 目的 |
|---------|---------|---------|
| `VIDMCP_TOOL_PACK` | `talking_head` | 只暴露特定产品路径的工具 |
| `VIDMCP_COMPACT` | `1` | 减少键值对 / 缩短长载荷 |
| `VIDMCP_MAX_RESULT_CHARS` | `4000` | 序列化工具结果的硬上限 |
**工具包:** `talking_head` · `education` · `vfx` · `admin` · `all`
```text
run_intent("为 reels 优化对话头,空间背景,去除填充词", video_path="talk.mov")
project_brief(project_id) # 优先于完整的 get_project
list_tool_packs() / set_tool_pack("vfx")
get_project(id, detail=true) # 仅在需要时获取完整清单
```
流程:`talking_head_polish` · `talking_head_reels` · `talking_head_space` · `talking_head_tight` · `talking_head_infographics`.
用于调试的完整表面:`VIDMCP_TOOL_PACK=all`.
---
## 图库
<p align="center">
<img src="https://raw.githubusercontent.com/dhirajlochib/VidMcp/main/demos/samples/07_creator_polish.gif" width="560" alt="Creator 1.1" /><br/>
<sub><b>1.1 创作者优化</b> — 方向调整 · 降噪 · 背景音乐 · 字幕 · 导出</sub>
</p>
<table>
<tr>
<td align="center" width="50%">
<img src="https://raw.githubusercontent.com/dhirajlochib/VidMcp/main/demos/samples/03_behind_subject.gif" width="100%" alt="Behind subject" /><br/>
<sub><b>主体背景</b></sub>
</td>
<td align="center" width="50%">
<img src="https://raw.githubusercontent.com/dhirajlochib/VidMcp/main/demos/samples/02_tesseract.gif" width="100%" alt="Tesseract" /><br/>
<sub><b>Tesseract</b> · 4D 特效</sub>
</td>
</tr>
<tr>
<td align="center" width="50%">
<img src="https://raw.githubusercontent.com/dhirajlochib/VidMcp/main/demos/samples/01_flowfield.gif" width="100%" alt="Flow" /><br/>
<sub><b>流场</b></sub>
</td>
<td align="center" width="50%">
<img src="https://raw.githubusercontent.com/dhirajlochib/VidMcp/main/demos/samples/05_unit_circle.gif" width="100%" alt="Unit circle" /><br/>
<sub><b>单位圆</b></sub>
</td>
</tr>
</table>
| 示例 | GIF | MP4 |
|--------|-----|-----|
| **创作者优化** | [gif](https://raw.githubusercontent.com/dhirajlochib/VidMcp/main/demos/samples/07_creator_polish.gif) | [mp4](https://raw.githubusercontent.com/dhirajlochib/VidMcp/main/demos/samples/07_creator_polish.mp4) |
| 流场 | [gif](https://raw.githubusercontent.com/dhirajlochib/VidMcp/main/demos/samples/01_flowfield.gif) | [mp4](https://raw.githubusercontent.com/dhirajlochib/VidMcp/main/demos/samples/01_flowfield.mp4) |
| Tesseract | [gif](https://raw.githubusercontent.com/dhirajlochib/VidMcp/main/demos/samples/02_tesseract.gif) | [mp4](https://raw.githubusercontent.com/dhirajlochib/VidMcp/main/demos/samples/02_tesseract.mp4) |
| 主体背景 | [gif](https://raw.githubusercontent.com/dhirajlochib/VidMcp/main/demos/samples/03_behind_subject.gif) | [mp4](https://raw.githubusercontent.com/dhirajlochib/VidMcp/main/demos/samples/03_behind_subject.mp4) |
| 动态 | [gif](https://raw.githubusercontent.com/dhirajlochib/VidMcp/main/demos/samples/04_kinetic.gif) | [mp4](https://raw.githubusercontent.com/dhirajlochib/VidMcp/main/demos/samples/04_kinetic.mp4) |
| 单位圆 | [gif](https://raw.githubusercontent.com/dhirajlochib/VidMcp/main/demos/samples/05_unit_circle.gif) | [mp4](https://raw.githubusercontent.com/dhirajlochib/VidMcp/main/demos/samples/05_unit_circle.mp4) |
| 流程 | [gif](https://raw.githubusercontent.com/dhirajlochib/VidMcp/main/demos/samples/06_pipeline.gif) | [mp4](https://raw.githubusercontent.com/dhirajlochib/VidMcp/main/demos/samples/06_pipeline.mp4) |
---
## 安装
**需求:** Python 3.11+,[ffmpeg](https://ffmpeg.org/),推荐 [uv](https://docs.astral.sh/uv/)
```bash
uv tool install vidmcp
vidmcp --doctor
# 或
pip install 'vidmcp[creator]' # + faster-whisper + mediapipe
```
### MCP (Grok / Claude / Cursor)
```bash
# Grok
grok mcp add vidmcp \
-e VIDMCP_SAM_BACKEND=mock \
-e VIDMCP_WORKSPACE_ROOT=$HOME/vidmcp-workspaces \
-e VIDMCP_TOOL_PACK=talking_head \
-e VIDMCP_COMPACT=1 \
-- uvx vidmcp
```
```json
{
"mcpServers": {
"vidmcp": {
"command": "uvx",
"args": ["vidmcp"],
"env": {
"VIDMCP_SAM_BACKEND": "mock",
"VIDMCP_WORKSPACE_ROOT": "/path/to/workspaces",
"VIDMCP_TOOL_PACK": "talking_head",
"VIDMCP_COMPACT": "1"
}
}
}
}
```
可选的 Apple Silicon 真实背景:
```bash
pip install 'vidmcp[mlx]'
export VIDMCP_SAM_BACKEND=mlx
export VIDMCP_MLX_MODEL_ID=mlx-community/sam3.1-bf16
```
---
## 核心产品
| | |
|---|---|
| **分割** | 文本提示主体分割(SAM / MLX / MediaPipe / mock) |
| **合成** | 主体 **后** 的特效 |
| **音频** | 降噪,增强,背景音乐 ducking,响度归一化 |
| **字幕** | Whisper 时间线 + 品牌水印 |
| **教育** | 数学板 + 语音锁定场景 |
| **导出** | 16:9 · 9:16 · 1:1 无拉伸 |
```text
create_project → import_video (方向调整)
→ process_audio → mix_bgm
→ segment_subject | replace_background
→ transcribe_and_caption → export_render
```
优先使用高级路径:`run_talking_head_polish` · `apply_recipe` · `run_quality_gated_pipeline`.
---
## 项目布局
```text
src/vidmcp/ MCP 服务器,创作者工具,感知,效果
demos/samples/ GIF · MP4 示例文件
site/ vidmcp.com (静态 Hostinger)
configs/ Claude / Cursor 代码片段
```
---
## 作者
**Dhiraj Lochib** — 全栈开发,区块链,人工智能
[dhirajlochib.com](https://dhirajlochib.com/) · [GitHub](https://github.com/dhirajlochib) · [LinkedIn](https://www.linkedin.com/in/dhirajlochib-dev/) · dhirajch145@gmail.com
---
## 许可证
[MIT](LICENSE)