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.lib和ggml.lib)都会位于 build\bin\Release 和 build\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

再执行指令

复制代码
相关推荐
东鹏特饮1 小时前
本机状态监控页面html
运维·css·html·css3
2501_915921431 小时前
KXBuild CI 实操,Windows/Linux 服务器接入 Jenkins 打包 iOS IPA
服务器·windows·vscode·ios·ci/cd·个人开发·敏捷流程
Gauss松鼠会1 小时前
GaussDB 整体架构解析
运维·服务器·网络·数据库·sql·架构·gaussdb
一技安身2 小时前
MySQL 8.4.13 LTS 通用二进制包(Linux免安装版)完整教程
linux·mysql·adb
迷途之人不知返2 小时前
【动态库与静态库】-3-静态链接与加载
linux
Gauss松鼠会2 小时前
GaussDB 中 gsql 与 DBeaver(JDBC)客户端工具查询时间不一致:原因、排查与处理
运维·服务器·数据库·sql·gaussdb·经验总结
谙弆悕博士2 小时前
debian快速换源
linux·运维·windows·debian·下载·换源·网络问题
.道阻且长.2 小时前
Linux基本开发工具:编译器gcc/g++
linux·运维·服务器·职场和发展
Industio_触觉智能2 小时前
瑞芯微RK系列调试工具与量产测试手册-上|串口日志打通与JTAG兜底调试
linux·sdk·jtag·瑞芯微·调试工具·rk3576·量产调试
Decay__9 小时前
05_MySQL 常用 SQL 大全 —— 诊断、管理、优化辅助 SQL 与三大系统库速查
运维·数据库·sql·mysql·架构