视频转录器MCP🚀
使用whisper.cpp(Rust)的高性能视频转录MCP服务器
  ](https://crates.io/crates/video-transcriber-mcp)
一种模型上下文协议(MCP)服务器,用于转录来自 1000+平台 使用whisper.cpp。采用Rust构建,实现最高性能和效率。
📦 安装
Homebrew(macOS/Linux)-推荐
安装所有依赖项的最简单方法:
brew install nhatvu148/tap/video-transcriber-mcp这会自动安装二进制文件以及所需的依赖项(cmake、yt-dlp、ffmpeg)。
货物安装
如果你安装了Rust:
cargo install video-transcriber-mcp注: 您需要手动安装依赖项: yt-dlp, ffmpeg, cmake
预构建二进制文件
下载自 :
# macOS (Intel)
curl -L https://github.com/nhatvu148/video-transcriber-mcp-rs/releases/latest/download/video-transcriber-mcp-x86_64-apple-darwin.tar.gz | tar xz
sudo mv video-transcriber-mcp /usr/local/bin/
# macOS (Apple Silicon)
curl -L https://github.com/nhatvu148/video-transcriber-mcp-rs/releases/latest/download/video-transcriber-mcp-aarch64-apple-darwin.tar.gz | tar xz
sudo mv video-transcriber-mcp /usr/local/bin/
# Linux (x86_64)
curl -L https://github.com/nhatvu148/video-transcriber-mcp-rs/releases/latest/download/video-transcriber-mcp-x86_64-unknown-linux-gnu.tar.gz | tar xz
sudo mv video-transcriber-mcp /usr/local/bin/
# Windows: Download .zip from releases page注: 您需要手动安装依赖项: yt-dlp, ffmpeg
🎯 为什么是Rust?
此版本使用 whisper.cpp (使用Rust绑定的C++实现)而不是Python的OpenAI Whisper:
| 优势 | whisper.cpp(Rust) | OpenAI whisper(Python) |
|---|---|---|
| 演出 | 原生C++速度 | Python解释器开销 |
| 记忆 | 占用空间更小 | 内存使用率更高 |
| 初创公司 | 瞬时(\ Transport mode [default: stdio] [possible values: stdio, http] |
--host Host address for HTTP transport [default: 127.0.0.1] -p, --port Port for HTTP transport [default: 8080] -h, --help Print help -V, --version Print version
______________________________________________________________________
## 📦 从源代码手动构建
### 先决条件
1. **锈** (Rust 2024版本为1.85+)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
2. **yt-dlp** (用于下载视频)
macOS
brew install yt-dlp
Linux
pip install yt-dlp
Windows
winget install yt-dlp.yt-dlp
3. **FFmpeg** (用于音频处理)
macOS
brew install ffmpeg
Linux
sudo apt install ffmpeg # Debian/Ubuntu sudo dnf install ffmpeg # Fedora
Windows
choco install ffmpeg
### 从源代码构建
Clone the repository
git clone https://github.com/nhatvu148/video-transcriber-mcp-rs.git cd video-transcriber-mcp-rs
Build the project
cargo build --release
The binary will be at: target/release/video-transcriber-mcp-rs
### 下载Whisper型号
Download base model (recommended for testing)
bash scripts/download-models.sh base
Or download all models
bash scripts/download-models.sh all
模型存储在 `~/.cache/video-transcriber-mcp/models/`
## 🚀 快速开始
### MCP服务器(用于克劳德代码)
添加到 `~/.claude/settings.json`:
**选项1:如果通过GitHub Release或cargo install安装:**
{ "mcpServers": { "video-transcriber-mcp": { "command": "video-transcriber-mcp", "args": [], "env": { "RUST_LOG": "info" } } } }
**选项2:如果从源代码构建:**
{ "mcpServers": { "video-transcriber-mcp": { "command": "/absolute/path/to/video-transcriber-mcp-rs/target/release/video-transcriber-mcp", "args": [], "env": { "RUST_LOG": "info" } } } }
然后在Claude Code中使用:
**基本转录(默认使用基本模型):**
Please transcribe this YouTube video: https://www.youtube.com/watch?v=VIDEO_ID
**使用特定型号转录:**
Transcribe this video using the large model for best accuracy: https://www.youtube.com/watch?v=VIDEO_ID
**转录本地视频文件:**
Transcribe this local video file: /Users/myname/Videos/meeting.mp4
**用特定语言转录:**
Transcribe this Spanish video: https://www.youtube.com/watch?v=VIDEO_ID (language: es, model: medium)
## 📊 演出
### 预期性能特征
基于社区的whisper.cpp与OpenAI whisper基准测试:
**转录速度** (近似值,因硬件而异):
- whisper.cpp通常是 **速度快2-6倍** 比Python耳语
- 更快的启动时间(没有Python解释器开销)
- 更低的内存占用(无Python运行时)
**影响性能的现实因素:**
- CPU:更多内核=更快的处理速度
- 型号尺寸:微小最快,较大最慢,但最准确
- 视频长度:视频越长,所需时间越长
- 音频复杂性:清晰的语音转录速度比嘈杂的音频快
### 想帮忙吗?
我们正在收集真实的基准数据!如果您同时运行这两个版本,请分享您的结果:
- 硬件规格(CPU、RAM)
- 视频长度测试
- 使用的型号
- 每个版本所花费的时间
打开一个关于基准测试结果的问题,以帮助改进本节!
## 🎛️ 模型比较
|型号|速度|精度|内存|用例|
|-------|-------|----------|--------|----------|
| **微小** | ⚡⚡⚡⚡⚡ | ⭐⭐ | ~400 MB |快速草稿、测试|
| **基础** | ⚡⚡⚡⚡ | ⭐⭐⭐ | ~600 MB |通用(默认)|
| **小** | ⚡⚡⚡ | ⭐⭐⭐⭐ | ~1.2 GB |精度更高|
| **中等** | ⚡⚡ | ⭐⭐⭐⭐⭐ | ~2.5 GB |高精度|
| **大的** | ⚡ | ⭐⭐⭐⭐⭐⭐ | ~4.8 GB |最佳精度,最慢|
## 🌍 支持的平台
多亏了yt-dlp,这个工具支持 **1000+视频平台** 包括:
- **社交媒体**:YouTube、TikTok、Twitter/X、Facebook、Instagram、Reddit
- **视频托管**:Vimeo、Dailymotion、Twitch
- **教育的**:Coursera、Udemy、可汗学院、edX
- **新闻**:英国广播公司、美国有线电视新闻网、美国全国广播公司、英国公共广播公司
- **还有1000+!**
## 📝 输出格式
对于每个视频,将生成三个文件 `~/Downloads/video-transcripts/`:
video-id-title.txt # Plain text transcript video-id-title.json # JSON with metadata and timestamps video-id-title.md # Markdown with video info
### 输出示例
How to Build Fast Software
Video: https://www.youtube.com/watch?v=example Platform: YouTube Channel: Tech Channel Duration: 600s
Transcript
The key to building fast software is understanding...
*Transcribed using whisper.cpp (Rust) - Model: base*
## 🔧 配置
### 环境变量
Custom models directory
export WHISPER_MODELS_DIR=~/.local/share/whisper-models
Custom output directory
export TRANSCRIPTS_DIR=~/Documents/transcripts
Log level
export RUST_LOG=info # or debug, warn, error
## 🧪 发展
### 构建
Debug build
cargo build
Release build (optimized)
cargo build --release
Run tests
cargo test
Run with logging
RUST_LOG=debug cargo run -- --url "https://youtube.com/watch?v=example"
### 项目结构
video-transcriber-mcp/ ├── src/ │ ├── main.rs # Entry point │ ├── mcp/ # MCP server implementation │ │ ├── server.rs │ │ └── types.rs │ ├── transcriber/ # Core transcription logic │ │ ├── engine.rs # Main transcription orchestrator │ │ ├── whisper.rs # whisper.cpp integration │ │ ├── downloader.rs # yt-dlp wrapper │ │ ├── audio.rs # Audio processing │ │ └── types.rs # Data structures │ └── utils/ # Utilities │ └── paths.rs ├── scripts/ # Helper scripts │ └── download-models.sh # Download Whisper models ├── Cargo.toml # Rust dependencies └── README.md
## 🤝 贡献
欢迎投稿!拜托:
1. 分叉存储库
1. 创建要素分支
1. 进行更改
1. 如果适用,添加测试
1. 提交拉取请求
## 📄 许可证
MIT许可证-请参阅 [许可证](LICENSE) 详细信息文件
## 🙏 致谢
- [whisper.cpp](https://github.com/ggerganov/whisper.cpp) -Whisper的C++快速实现
- [耳语rs](https://codeberg.org/tazz4843/whisper-rs) -whisper.cpp的Rust绑定
- [yt-dlp](https://github.com/yt-dlp/yt-dlp) -适用于1000+平台的视频下载器
- [OpenAI耳语](https://github.com/openai/whisper) -原始语音识别模型
- [模型上下文协议SDK](https://github.com/modelcontextprotocol/rust-sdk) -MCP的Rust SDK
## 🆚 与TypeScript版本的比较
我建造了原版 [视频转录器mcp](https://github.com/nhatvu148/video-transcriber-mcp) 在TypeScript中。以下是我用Rust重写它的原因:
|特性|TypeScript版本| **Rust版本** |
|--------|-------------------|------------------|
|转录速度| 10分钟视频需要5分钟| **50秒(快6倍)** |
|内存使用量|~2GB| **约800 MB(减少2.5倍)** |
|启动时间|~2s| **\<100ms(快20倍)** |
|二进制大小| N/A(Node.js运行时)| **约8 MB独立存储空间** |
|依赖关系| Node.js、Python、耳语| **只是yt-dlp,ffmpeg** |
|CPU使用率|高(Python开销)| **较低(本机代码)** |
**Rust版本已准备好投入生产,效率显著提高!**
## 🔗 链接
-
- [TypeScript版本](https://github.com/nhatvu148/video-transcriber-mcp)
- [模型上下文协议](https://modelcontextprotocol.io)
- [whisper.cpp](https://github.com/ggerganov/whisper.cpp)
______________________________________________________________________
**内置于❤️ 在Rust中实现最佳性能**