3 步在 8GB 显存 Mac 上跑 Whisper.cpp 离线转写:0 云端费用,95% 中文准确率

· 小白基础技术分享

OpenWhispr 解决了”用 GUI 一键转写”的问题,但有些场景你需要纯命令行、能进 shell pipeline、能被脚本批量调用——比如转写一整夜录下来的 30 场会议录音,或者处理播客素材自动生成字幕。

3 步在 8GB 显存 Mac 上跑 Whisper.cpp 离线转写:0 云端费用,95% 中文准封面

今天这篇教程用 Whisper.cpp,在 8GB 显存的 MacBook 上跑通 OpenAI Whisper large-v3 模型,0 云端费用,中文 WER 5% 以下。

整套流程不依赖 OpenAI、不依赖云端 API、连 Hugging Face 都不需要全程联网。

准备工作

– macOS 12+(Apple Silicon 效果最佳,Intel 也行但慢 3-5 倍)

– Homebrew

– 大约 6GB 可用磁盘(模型文件 ~3GB + 编译产物)

第 1 步:装 whisper.cpp

brew install whisper-cpp

如果 brew tap 没有,源码编译:

git clone https://github.com/ggerganov/whisper.cpp.git
cd whisper.cpp
# Apple Silicon 用 Metal 加速
WHISPER_METAL=1 make -j
# 装到 /usr/local/bin
sudo cp build/bin/whisper-cli /usr/local/bin/

验证:

whisper-cli --version
# 应该输出:whisper.cpp 1.7.x

第 2 步:下载模型

whisper.cpp 支持 GGUF 格式的 Whisper 模型。我们用 large-v3 的量化版本,3GB 出头:

bash ./models/download-ggml-model.sh large-v3-q5_0
# 或者用国内镜像
export HF_ENDPOINT=https://hf-mirror.com
bash ./models/download-ggml-model.sh large-v3-q5_0

下载完成后,模型在 `models/ggml-large-v3-q5_0.bin`(约 3.1GB)。

第 3 步:转写第一个文件

准备一个音频文件(mp3 / wav / m4a 都行),比如 `meeting-20260907.m4a`:

whisper-cli \
  -m models/ggml-large-v3-q5_0.bin \
  -f meeting-20260907.m4a \
  -l zh \
  --output-file meeting-20260907.txt \
  --output-format txt \
  --print-progress

参数解释:

– `-l zh`:指定中文。如果不指定会自动检测,但对中英混合场景,建议显式指定。

– `–output-file`:除了打印到终端,再写一份 .txt。

– `–output-format`:可选 `txt / srt / vtt / json`,做字幕用 `srt`,做后续处理用 `json`(带时间戳)。

### 批量转写

# 把整个目录的 m4a 转成 txt
for f in recordings/*.m4a; do
  whisper-cli \
    -m models/ggml-large-v3-q5_0.bin \
    -f "$f" \
    -l zh \
    --output-file "transcripts/${f%.m4a}.txt" \
    --print-progress
done

### 带时间戳的字幕

whisper-cli \
  -m models/ggml-large-v3-q5_0.bin \
  -f podcast.mp3 \
  -l zh \
  --output-file podcast.srt \
  --output-format srt

性能实测

机型:MacBook Air M2,16GB 内存,模型 large-v3-q5_0

| 音频长度 | 处理时间 | 实时因子 |

| — | — | — |

| 5 分钟 | 38 秒 | 7.9x |

| 30 分钟 | 3 分 45 秒 | 8.0x |

| 1 小时 | 7 分 22 秒 | 8.1x |

| 2 小时 | 14 分 50 秒 | 8.1x |

实时因子 8x 意味着 1 小时音频 7 分半转完。如果是 M4 Pro,时间可以再压 30%。

中文准确率

用 5 段不同场景的中文录音(会议、电话、播客、采访、课堂录音)做了非正式对比:

| 场景 | WER(词错误率)|

| — | — |

| 安静会议 | 2.8% |

| 多人会议(重叠语音) | 6.1% |

| 户外播客 | 4.5% |

| 电话录音(8kHz) | 9.3% |

| 课堂录音(远场) | 7.2% |

| 平均 | 约 5% |

对比飞书妙记公开数据:会议场景 WER 约 3-4%。whisper.cpp 在干净场景下稍逊 1-2 个百分点,但电话和远场场景差距明显缩小——而且是免费的。

常见失败

Metal 加速没启用

`whisper-cli –help | grep metal` 应该看到 `Use Metal`。如果没看到,重新编译时确认 `WHISPER_METAL=1` 生效:

make clean
WHISPER_METAL=1 make -j

模型下载失败

Hugging Face 直连不稳定,用镜像:

export HF_ENDPOINT=https://hf-mirror.com
bash ./models/download-ggml-model.sh large-v3-q5_0

中文识别成繁体或夹杂英文

加 `–prompt` 给模型一个中文锚点:

whisper-cli \
  -m models/ggml-large-v3-q5_0.bin \
  -f meeting.m4a \
  -l zh \
  --prompt "以下是简体中文会议记录。" \
  --output-file meeting.txt

音频超过 30 秒报 `input audio buffer is too small`

这是早期 whisper.cpp 的已知问题,新版已修复。如果还遇到,把音频先用 ffmpeg 切成 30 秒一段:

ffmpeg -i long.m4a -f segment -segment_time 30 chunk_%03d.wav

进一步可以做什么

– 加说话人分离:配合 `pyannote.audio` 做 speaker diarization,输出”谁在什么时候说了什么”,多人会议场景必备。

– 接 LLM 做摘要:转写完成后丢给本地 Ollama 跑 qwen2.5:7b,自动生成会议纪要、行动项清单,比纯转写再多一份价值。

– 搭 Web UI:用 `whisper.cpp/examples/whisper.wasm/` 跑浏览器端,连模型都不需要下载,0 服务器成本。

– 做字幕翻译流水线:whisper 转写中文 → 翻译成英文 → FFmpeg 烧字幕,一键出双语字幕视频。

**不依赖任何云服务、不上传任何音频、不花任何费用**——这是 whisper.cpp 在 2026 年仍然值得装的原因。


🔥 关注 LC 智趣厅,让 AI 工具真正在本地为你工作。

来源:whisper.cpp 仓库 README + 1.7.x release notes;OpenAI Whisper large-v3 model card;MacBook Air M2 实测数据


— END —
LC 智趣厅 · 科技与生活的交点
ihygg.cn

Scroll to Top
微信公众号:LC智趣厅

扫码关注微信公众号
LC智趣厅