跳到主要内容

Whisper 速查表

Whisper 是 OpenAI 开源的通用语音识别模型。支持 100+ 语言的转录和翻译,提供 tiny/base/small/medium/large 多个模型尺寸,可在 CPU 或 GPU 上运行。支持 txt/vtt/srt/tsv/json 多种输出格式。

更新: 2026-07-20·20 条命令

快速开始

``bash # 安装 pip install openai-whisper

# 基本转录 whisper recording.mp3

# 指定模型和语言 whisper meeting.mp3 --model small --language zh

# 中文音频翻译为英文 whisper chinese_speech.mp3 --task translate

# 生成 SRT 字幕 whisper video_audio.mp3 --model base --output_format srt --output_dir ./subtitles

# GPU 加速转录 whisper long_podcast.mp3 --model medium --device cuda --fp16 True `

模型尺寸

五个预训练模型:tiny(39M 参数,~1GB 显存)、base(74M)、small(244M,~2GB)、medium(769M,~5GB)、large(1.5B,~10GB)。首次使用自动下载。

转录与翻译

两种任务模式:transcribe(原语言转文字)和 translate(转英文)。用 --language 指定源语言提高准确率。双语音频自动检测。

输出格式

txt(纯文本,默认)、vtt(WebVTT 字幕)、srt(SubRip 字幕)、tsv(带时间戳的表格)、json(完整元数据,含片段和逐词时间戳)。用 all 一次性生成所有格式。

高级选项

--initial_prompt 引导风格或领域术语。--temperature 控制采样随机性(0 = 确定性)。--condition_on_previous_text` 改善长音频连贯性。Shell 通配符批量转录多个文件。

启动模式(20)

命令难度
whisper --help
显示 Whisper CLI 帮助
基础
whisper audio.mp3
转录音频文件为文字(基本用法)
基础
whisper audio.mp3 --model
指定 Whisper 模型大小
基础
whisper audio.mp3 --model tiny
使用最小模型(最快,最不准确)
基础
whisper audio.mp3 --model large
使用最大模型(最慢,最准确)
基础
whisper audio.mp3 --language
指定音频语言(提高准确率)
中级
whisper audio.mp3 --task transcribe
转录任务(默认,保持原语言)
基础
whisper audio.mp3 --task translate
翻译任务(将任何语言翻译为英文)
基础
whisper audio.mp3 --output_format
指定输出格式(txt/vtt/srt/tsv/json/all)
中级
whisper audio.mp3 --output_dir
指定输出目录
基础
whisper audio.mp3 --device
指定推理设备(cpu/cuda)
中级
whisper audio.mp3 --fp16
启用半精度推理(GPU 加速)
中级
whisper audio.mp3 --verbose
显示详细输出(含时间戳和置信度)
基础
whisper audio.mp3 --temperature
设置采样温度(0-1,默认 0)
中级
whisper audio.mp3 --initial_prompt
设置初始提示词(引导风格或纠正术语)
高级
whisper audio.mp3 --condition_on_previous_text
利用前文提高连贯性
中级
pip install openai-whisper
安装 Whisper
基础
pip install openai-whisper[audio]
安装 Whisper(含音频依赖)
基础
whisper --model small audio.mp3
使用 small 模型转录(速度与质量的平衡)
基础
whisper dir/*.mp3
批量转录目录下所有音频文件
中级

常见问题

本速查表数据整理自各工具官方文档。最后更新: 2026-07-20。