关于 whisper
whisper 是使用 OpenAI Whisper 将音频文件转为文本的 skill,适合需要处理录音的用户。它支持多种音频格式、90 多种语言、时间戳以及文本或 JSON 输出。
主要功能
- 01转录多种音频格式
- 02自动检测 90 多种语言
- 03可选生成时间戳
- 04支持多种模型尺寸
- 05输出文本或 JSON
适用场景
- 01将录音转换为文字
- 02为转录内容添加时间戳
- 03生成 JSON 格式的转录结果
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ trpc-group/ trpc-agent-go --skill whisper安装后在 Claude Code 中输入/whisper确认已加载。
附带文件scripts/transcribe.py
详细介绍
Whisper 音频转录技能
使用 OpenAI Whisper 将音频文件转录为文本。
功能
- 将音频文件(MP3、WAV、M4A、FLAC、OGG 等)转录为文本
- 支持 90 多种语言并可自动检测
- 可选生成时间戳
- 支持多种模型大小(tiny/base/small/medium/large)
- 支持纯文本或 JSON 格式输出
用法
基本转录
python3 scripts/transcribe.py <audio_file> <output_file>
使用选项
# Specify model size (default: base)
python3 scripts/transcribe.py audio.mp3 transcript.txt --model medium
# Specify language (improves accuracy)
python3 scripts/transcribe.py audio.mp3 transcript.txt --language zh
# Include timestamps
python3 scripts/transcribe.py audio.mp3 transcript.txt --timestamps
# JSON output with metadata
python3 scripts/transcribe.py audio.mp3 output.json --format json
参数
audio_file(必需):输入音频文件的路径output_file(必需):输出文本/JSON 文件的路径--model:Whisper 模型大小(tiny/base/small/medium/large,默认:base)--language:语言代码(例如 en、zh、es、fr;自动检测请使用 auto)--timestamps:在输出中包含词级时间戳--format:输出格式(text/json,默认:text)
模型大小
| 模型 | 参数量 | 速度 | 准确度 | 内存 |
|---|---|---|---|---|
| tiny | 39M | ~32x | 良好 | ~1GB |
| base | 74M | ~16x | 更好 | ~1GB |
| small | 244M | ~6x | 很好 | ~2GB |
| medium | 769M | ~2x | 极佳 | ~5GB |
| large | 1.5B | 1x | 最佳 | ~10GB |
支持的音频格式
MP3、WAV、M4A、FLAC、OGG、AAC、WMA 等(通过 FFmpeg 支持)
依赖项
- Python 3.8+
- openai-whisper
- ffmpeg
安装
pip install openai-whisper
sudo apt-get install ffmpeg # Ubuntu/Debian
评论
支持 Markdown