名称: faster-whisper
描述: "使用 faster-whisper 进行本地语音转文本。速度比 OpenAI Whisper 快 4-6 倍,精度相同;GPU 加速可实现约 20 倍实时转录速度。支持 SRT/VTT/TTML/CSV 字幕、说话人分离、URL/YouTube 输入、带 ETA 的批处理、转录本搜索、章节检测、按文件语言映射。"
版本: 1.5.1
作者: ThePlasmak
主页: https://github.com/ThePlasmak/faster-whisper
标签:
[
"audio",
"transcription",
"whisper",
"speech-to-text",
"ml",
"cuda",
"gpu",
"subtitles",
"diarization",
"podcast",
"chapters",
"search",
"csv",
"ttml",
"batch",
]
platforms: ["linux", "macos", "wsl2"]
元数据:
{
"openclaw":
{
"emoji": "🗣️",
"requires":
{
"bins": ["python3"],
"optionalBins": ["ffmpeg", "yt-dlp"],
"optionalPaths": ["~/.cache/huggingface/token"],
},
},
}
使用 faster-whisper 进行本地语音转文本——这是 OpenAI Whisper 的 CTranslate2 重新实现,在保持相同精度的前提下,运行速度快 4-6 倍。借助 GPU 加速,可实现约 20 倍实时的转录速度(约 30 秒转录 10 分钟音频文件)。
当你需要以下功能时,请使用此技能:
--diarize)--rss <feed-url> 获取并转录剧集--translate 将任何语言翻译成英文--language-map 为每个文件分配不同语言--multilingual 用于混合语言音频--initial-prompt 处理专业术语或需要留意的任何其他术语--normalize 和 --denoise--stream 实时显示转录片段--clip-timestamps 转录特定部分--search "term" 查找单词/短语出现的所有时间戳--detect-chapters 从静默间隙查找章节断点--export-speakers DIR 将每个说话人的发言保存为单独的 WAV 文件--format csv 生成带时间戳且正确引用的 CSV触发短语:
"transcribe this audio", "convert speech to text", "what did they say", "make a transcript",
"audio to text", "subtitle this video", "who's speaking", "translate this audio", "translate to English",
"find where X is mentioned", "search transcript for", "when did they say", "at what timestamp",
"add chapters", "detect chapters", "find breaks in the audio", "table of contents for this recording",
"TTML subtitles", "DFXP subtitles", "broadcast format subtitles", "Netflix format",
"ASS subtitles", "aegisub format", "advanced substation alpha", "mpv subtitles",
"LRC subtitles", "timed lyrics", "karaoke subtitles", "music player lyrics",
"HTML transcript", "confidence-colored transcript", "color-coded transcript",
"separate audio per speaker", "export speaker audio", "split by speaker",
"transcript as CSV", "spreadsheet output", "transcribe podcast", "podcast RSS feed",
"different languages in batch", "per-file language",
"transcribe in multiple formats", "srt and txt at the same time", "output both srt and text",
"remove filler words", "clean up ums and uhs", "strip hesitation sounds", "remove you know and I mean",
"transcribe left channel", "transcribe right channel", "stereo channel", "left track only",
"wrap subtitle lines", "character limit per line", "max chars per subtitle",
"detect paragraphs", "paragraph breaks", "group into paragraphs", "add paragraph spacing"
⚠️ 智能体指导原则 —— 保持调用简洁:
核心规则:默认命令 (./scripts/transcribe audio.mp3) 是最快路径 —— 仅在用户明确要求某项功能时才添加对应标志。
转录:
--diarize--format srt/vtt/ass/lrc/ttml--format csv--word-timestamps--initial-prompt--translate--normalize/--denoise--stream--clip-timestamps--temperature 0.0--vad-threshold--min-speakers/--max-speakers~/.cache/huggingface/token 时,才添加 --hf-token--max-words-per-line--filter-hallucinations--merge-sentences--clean-filler--channel left|right--max-chars-per-line N;优先级高于 --max-words-per-line--detect-paragraphs;--paragraph-gap(默认 3.0 秒)仅在他们想要自定义间隔时使用--speaker-names "Alice,Bob" —— 始终需要 --diarize--initial-prompt 无法很好处理的特定罕见术语时,才添加 --hotwords WORDS;对于一般领域术语,优先使用 --initial-prompt--prefix TEXT--detect-language-only--stats-file PATH--parallel N;GPU 本身能高效处理单个文件 —— 不要为单个文件或小批量添加--retries N--burn-in OUTPUT;需要 ffmpeg 和视频文件输入--keep-temp--output-template--format srt,text):仅当用户明确希望一次生成多种格式时使用;始终与 -o <dir> 配对使用--diarize 在此基础上增加约 20-30 秒搜索:
--search "term"--search 替换正常的转录本输出 —— 它只打印带时间戳的匹配片段--search-fuzzy-o results.txt章节检测:
--detect-chapters--chapter-gap 8(8 秒静默 = 新章节)适用于大多数播客/讲座;对于密集内容可调低--chapter-format youtube(默认)输出 YouTube 就绪的时间戳;使用 json 用于编程用途--chapters-file PATH —— 避免将章节标记混入转录本文本-o /dev/null 将标准输出重定向到文件,并使用 --chapters-file--chapters-file 接受单个路径 —— 在批处理模式下,每个文件的章节会覆盖前一个。对于批量章节检测,请省略 --chapters-file(章节在 === CHAPTERS (N) === 下打印到标准输出),或为每个文件单独运行说话人音频导出:
--export-speakers DIR--diarize 配对使用 —— 如果没有说话人标签,它会静默跳过SPEAKER_1.wav、SPEAKER_2.wav 等(如果设置了 --speaker-names,则使用真实姓名)语言映射:
--language-map"interview*.mp3=en,lecture*.mp3=fr" —— 对文件名使用 fnmatch 通配符@/path/to/map.json,其中文件内容为 {"pattern": "lang_code"}RSS / 播客:
--rss URL--rss-latest 0 获取所有;--skip-existing 安全恢复-o <dir> 一起使用 --rss —— 没有它,所有剧集转录本会连接打印到标准输出,难以使用;设置 -o <dir> 后,每个剧集都有自己的文件智能体中继的输出格式:
--search) → 直接打印给用户;输出是人类可读的--chapters-file,章节会出现在转录本后的 === CHAPTERS (N) === 标题下的标准输出中;使用 --format json 时,章节也嵌入在 JSON 的 "chapters" 键下-o 文件;告诉用户输出路径,切勿粘贴原始字幕内容-o 文件;告诉用户输出路径,不要粘贴原始 XML/CSV/HTML--format srt,text) → 需要 -o <dir>;每种格式写入单独的文件;告诉用户所有写入的路径--stats-file) → 为用户总结关键字段(时长、处理时间、RTF),而不是粘贴原始 JSON--detect-language-only) → 直接打印结果;它是单行何时不使用:
faster-whisper 与 whisperx:
此技能涵盖了 whisperx 的所有功能 —— 说话人分离 (--diarize)、词级时间戳 (--word-timestamps)、SRT/VTT 字幕 —— 因此不需要 whisperx。仅当你特别需要其 pyannote 管道或此处未涵盖的批处理 GPU 功能时,才使用 whisperx。
| 任务 | 命令 | 说明 |
|---|---|---|
| 基本转录 | ./scripts/transcribe audio.mp3 |
批处理推理,VAD 开启,distil-large-v3.5 |
| SRT 字幕 | ./scripts/transcribe audio.mp3 --format srt -o subs.srt |
自动启用词级时间戳 |
| VTT 字幕 | ./scripts/transcribe audio.mp3 --format vtt -o subs.vtt |
WebVTT 格式 |
| 词级时间戳 | ./scripts/transcribe audio.mp3 --word-timestamps --format srt |
wav2vec2 对齐(约 10 毫秒) |
| 说话人分离 | ./scripts/transcribe audio.mp3 --diarize |
需要 pyannote.audio |
| 翻译 → 英文 | ./scripts/transcribe audio.mp3 --translate |
任何语言 → 英文 |
| 流式输出 | ./scripts/transcribe audio.mp3 --stream |
实时显示转录片段 |
| 剪辑时间范围 | ./scripts/transcribe audio.mp3 --clip-timestamps "30,60" |
仅转录 30 秒–60 秒 |
| 降噪 + 标准化 | ./scripts/transcribe audio.mp3 --denoise --normalize |
先清理嘈杂音频 |
| 减少幻觉 | ./scripts/transcribe audio.mp3 --hallucination-silence-threshold 1.0 |
跳过幻觉产生的静默 |
| YouTube/URL | ./scripts/transcribe https://youtube.com/watch?v=... |
通过 yt-dlp 自动下载 |
| 批处理 | ./scripts/transcribe *.mp3 -o ./transcripts/ |
输出到目录 |
| 批处理并跳过已存在 | ./scripts/transcribe *.mp3 --skip-existing -o ./out/ |
恢复中断的批处理 |
| 领域术语 | ./scripts/transcribe audio.mp3 --initial-prompt 'Kubernetes gRPC' |
提升罕见术语识别度 |
| 热词提升 | ./scripts/transcribe audio.mp3 --hotwords 'JIRA Kubernetes' |
使解码器偏向特定单词 |
| 前缀条件 | ./scripts/transcribe audio.mp3 --prefix 'Good morning,' |
用已知开头单词引导第一个片段 |
| 固定模型版本 | ./scripts/transcribe audio.mp3 --revision v1.2.0 |
使用固定版本进行可复现的转录 |
| 调试库日志 | ./scripts/transcribe audio.mp3 --log-level debug |
显示 faster_whisper 内部日志 |
| Turbo 模型 | ./scripts/transcribe audio.mp3 -m turbo |
large-v3-turbo 的别名 |
| 更快的英文转录 | `./scripts/transcribe |