使用 FunASR (SenseVoice) 批量转录音频文件的 Claude Code Skill。
- 并行转录(可配置进程数)
- 断点续传(跳过已完成文件)
- 失败重试(记录失败文件)
- 支持格式:m4a、mp3、wav、flac、aac
- 输出格式:每个音频生成
.txt+.json
pip install funasr modelscope首次运行会自动下载模型到 ~/.cache/modelscope/,或手动下载:
from modelscope import snapshot_download
snapshot_download('iic/SenseVoiceSmall')
snapshot_download('iic/speech_fsmn_vad_zh-cn-16k-common-pytorch')将此仓库克隆到你的 skills 目录:
# Claude Code
git clone https://github.com/shuolsure/FunASR-skill.git ~/.claude/skills/funasr-batch-transcribe
# 或 iFlow CLI
git clone https://github.com/shuolsure/FunASR-skill.git ~/.iflow/skills/funasr-batch-transcribe在 Claude Code 或 iFlow CLI 中,使用以下触发词:
- 批量转录
- 音频转文字
- 语音识别
- FunASR
- ASR
- 转录音频目录
python3 ~/.iflow/skills/funasr-batch-transcribe/scripts/batch_transcribe.py \
/path/to/audio -o /path/to/output -j 4| 参数 | 说明 | 默认值 |
|---|---|---|
input_dir |
音频文件目录(必需) | - |
-o, --output |
输出目录 | ~/transcripts |
-j, --jobs |
并行进程数 | 1 |
--retry |
重试失败文件 | - |
每个音频生成两个文件:
.txt- 纯文本转录结果.json- 结构化数据(文件路径、文本、耗时)
辅助文件:
.progress.json- 进度记录failed_files.txt- 失败列表
# 基本使用
python3 batch_transcribe.py ./recordings -o ./transcripts -j 2
# 重试失败的文件
python3 batch_transcribe.py ./recordings -o ./transcripts --retry- 模型:SenseVoiceSmall + VAD
- 并行:Python multiprocessing
- RTF:约 0.1-0.3(取决于硬件)
Apache 2.0