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

再执行指令

复制代码
相关推荐
一叶龙洲2 小时前
wslg打开Ubuntu24.04默认打开图形界面
linux·服务器·数据库·ubuntu
敖行客 Allthinker4 小时前
Parallels Ubuntu虚拟机项目如何让手机访问?完整解决方案
linux·运维·ubuntu
keyipatience5 小时前
线程栈与TLS和线程互斥
java·linux·服务器·开发语言·ubuntu
元Y亨H5 小时前
生产环境监控与故障应急处理(5-5-5 标准)指南
运维
j7~5 小时前
【Linux】二十二.《Linux 信号机制完全指南:表示、捕捉与处理》
linux·信号处理·volatile·可入重函数·保存信号
踏月的造梦星球5 小时前
达梦数据库执行计划与性能分析入门:EXPLAIN、AUTOTRACE 与 ET
服务器·数据库·oracle
观山岳五楼6 小时前
Ubuntu 24 怎么使用Ubuntu 20 的镜像源
linux·运维·ubuntu
星夜夏空996 小时前
网络编程(1)
服务器·网络
川石课堂软件测试6 小时前
安全测试|常见SQL注入攻击方式、实例及预防
服务器·数据库·sql·功能测试·测试工具·安全·单元测试
m0_715646766 小时前
20260720
linux·arm