whisper.cpp编译

一、开始常规编译

# 1. 进入 whisper.cpp 源代码目录

cd path\to\whisper.cpp

# 2. 创建一个专门的构建目录,并进入

mkdir build && cd build

# 3. 使用 CMake 配置项目,生成 MSVC 解决方案文件

cmake .. -A x64

# 4. 开始编译,生成库文件和示例程序(例如 whisper-cli.exe)

cmake --build . --config Release

二、编译带SDL2支持的whisper.cpp

地址下载SDL2,版本要是:2.30.8-VC

https://github.com/libsdl-org/SDL/tree/release-3.4.10

复制代码
cd E:\digitalHuman\libs\whisper.cpp\build
# 清理之前的缓存(重要!)
Remove-Item * -Recurse -Force

# 关键:使用 -DSDL2_DIR 指向包含 sdl2-config.cmake 的目录
cmake .. -A x64 -DWHISPER_SDL2=ON -DSDL2_DIR=E:\digitalHuman\libs\SDL2-devel-2.30.8-VC\SDL2-2.30.8\cmake

编译成功后,所有生成的文件(包括静态库whisper.libggml.lib)都会位于 build\bin\Releasebuild\src\Release目录下

三、下载模型:

先到路径:whisper.cpp\models

复制代码
./download-ggml-model.cmd base
复制代码
cd E:\digitalHuman\libs\whisper.cpp
.\models\download-ggml-model.cmd small   # 约 488 MB
# 或
.\models\download-ggml-model.cmd medium  # 约 1.5 GB

四、在PowerShell中执行指令

.\whisper-stream.exe -m E:\digitalHuman\libs\whisper.cpp\models\ggml-base.bin -t 4 --step 300 --length 6000 -l zh -vth 0.6

增加 -vth 参数,让模型只在语音能量较高时识别:

复制代码
--length 5000 --step 500 更长的窗口(5 秒)可以提供更多上下文,帮助模型纠正错误。

.\whisper-stream.exe -m E:\digitalHuman\libs\whisper.cpp\models\ggml-medium.bin -t 4 --step 500 --length 3000 -l zh

.\whisper-stream.exe -m E:\digitalHuman\libs\whisper.cpp\models\ggml-base.bin -t 4 --step 500 --length 3000 -l zh

五、在 PowerShell 中设置输出编码

复制代码
先执行[Console]::OutputEncoding = [System.Text.Encoding]::UTF8

再执行指令

复制代码
相关推荐
载数而行5201 小时前
Linux 8 进程(树)相关指令
linux
深圳恒讯1 小时前
越南服务器 ping 值多少?
运维·服务器
ShineWinsu1 小时前
对于Linux:内核是如何组织管理IPC资源的解析
linux·服务器·c++·面试·笔试·线程·ipc
caimouse2 小时前
Reactos 第 5 章 进程与线程 — 5.3 系统调用 NtCreateProcess()
服务器·开发语言
yuanjj882 小时前
域格ASR平台cat1模块FTP上传、下载
运维·网络
feng_you_ying_li2 小时前
Linux之线程同步:条件变量和两种生产消费模型
linux·运维·服务器
tianyuanwo2 小时前
OS运维智能化落地抉择:构建故障诊断AI Skill VS 沉淀领域知识库,谁是核心先手?
运维·人工智能·知识库·skill
Dlrb12112 小时前
Linux系统编程-线程与多线程模块的封装
linux·线程·互斥锁·线程同步·线程互斥
拾贰_C2 小时前
【Ubuntu | VSCode | SSH | 远程连接 | Linux】VSCode 怎么实现ssh远程连接
linux·vscode·ubuntu