Environment preparation before first use
Quick start
用户: 安装环境
用户: 初始化
用户: 下载模型
Dependency list
| Dependencies | Purpose | Installation command |
|---|---|---|
| funasr | Speech error recognition | pip install funasr |
| modelscope | Model download | pip install modelscope |
| openai-whisper | Subtitle generation | pip install openai-whisper |
| ffmpeg | Video editing | brew install ffmpeg |
Model list
FunASR models (for speech error recognition)
Automatically downloaded on first run to ~/.cache/modelscope/:
| Model | Size | Purpose |
|---|---|---|
| paraformer-zh | 953MB | Speech recognition (with timestamps) |
| punc_ct | 1.1GB | Punctuation prediction |
| fsmn-vad | 4MB | Voice activity detection |
| Subtotal | ~2GB |
Whisper models (for subtitle generation)
Automatically downloaded on first run to ~/.cache/whisper/:
| Model | Size | Purpose |
|---|---|---|
| large-v3 | 2.9GB | Subtitle transcription (best quality) |
Total
Approx. 5GB model files
Installation process
1. 安装 Python 依赖
↓
2. 安装 FFmpeg
↓
3. 下载 FunASR 模型(口误识别)
↓
4. 下载 Whisper 模型(字幕生成)
↓
5. 验证环境
Execution steps
1. Install Python dependencies
pip install funasr modelscope openai-whisper
2. Install FFmpeg
# macOS
brew install ffmpeg
# Ubuntu
sudo apt install ffmpeg
# 验证
ffmpeg -version
3. Download FunASR models (approx. 2GB)
from funasr import AutoModel
model = AutoModel(
model="paraformer-zh",
vad_model="fsmn-vad",
punc_model="ct-punc",
)
print("FunASR 模型下载完成")
4. Download Whisper models (approx. 3GB)
import whisper
model = whisper.load_model("large-v3")
print("Whisper 模型下载完成")
5. Verify the environment
from funasr import AutoModel
model = AutoModel(
model="paraformer-zh",
vad_model="fsmn-vad",
punc_model="ct-punc",
disable_update=True
)
# 测试转录(用任意音频/视频)
result = model.generate(input="test.mp4")
print("文本:", result[0]['text'][:50])
print("时间戳数量:", len(result[0]['timestamp']))
print("✅ 环境就绪")
Common issues
Q1: Model download is slow
Solution: Use a domestic mirror or download manually
Q2: ffmpeg command not found
Solution: Confirm it is installed and added to PATH
which ffmpeg # 应该输出路径
Q3: funasr import error
Solution: Check the Python version (requires 3.8+)
python3 --version