LoongLee's blog

Whisper语音转写

Whisper语音转写

来源

原始文档: whisper_use.md

核心内容

OpenAI Whisper 是开源的自动语音识别(ASR)系统,支持多语言语音转文字。

安装

# 标准版
pip install -U openai-whisper ffmpeg-python

# 更快版本(推荐)
pip install -U faster-whisper

使用方法

标准 Whisper

whisper 商业航天.mp4 --language Chinese --model medium --output_format txt

Faster Whisper

faster-whisper 商业航天.mp4 --language zh --model medium

参数说明

参数 说明
--language 语言代码(zh/Chinese 中文)
--model 模型大小(tiny/base/small/medium/large)
--output_format 输出格式(txt/srt/vtt/json/all)

模型大小对比

模型 参数 内存需求 速度 准确率
tiny 39M ~1GB 最快 一般
base 74M ~1GB 良好
small 244M ~2GB 中等 很好
medium 769M ~5GB 优秀
large 1550M ~10GB 最慢 最佳

关键要点

  • faster-whisper 使用 CTranslate2 优化,速度更快
  • medium 模型在速度和准确率间取得良好平衡
  • 支持多种输出格式(txt/srt/vtt)
  • 需要 ffmpeg 处理音视频文件

相关实体

  • Whisper - OpenAI 语音识别模型
  • 语音识别 - ASR 技术
  • AI - 人工智能
  • Python - Python 编程语言