stt

jianchang512GPL-3.0更新放缓

离线运行的本地音视频转字幕工具,能把语音识别成文字,输出 JSON、SRT 字幕和纯文本格式,适合不想上传云端、注重隐私的字幕制作场景。

Voice Recognition to Text Tool / 一个离线运行的本地音视频转字幕工具,输出json、srt字幕、纯文字格式

20250805发布于 2025-08-05 05:09 UTC4,847star +4 / 7 天512fork同步于 2026-11-10 23:38 UTC

怎么上手

由 README 提炼,执行前请确认
git clone [email protected]:jianchang512/stt.git .
pip install -r requirements.txt
python start.py
硬件要求按 README 说明

默认使用 CPU 运算;有英伟达显卡并配置好 CUDA 环境后可改 set.ini 中 devtype=cuda 加速。显存不足 8G 时避免用 large-v3,尤其视频大于 20M 时。

需要 CUDA
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

离线本地音视频转字幕工具,基于 faster-whisper,可替代 OpenAI 语音识别接口

离线运行的本地音视频转字幕工具,能把语音识别成文字,输出 JSON、SRT 字幕和纯文本格式,适合不想上传云端、注重隐私的字幕制作场景。

核心能力

  • 基于 faster-whisper 离线识别音视频人声
  • 输出 json、带时间戳 srt 字幕和纯文字三种格式
  • 提供 HTTP API,可 POST 上传文件指定语言与模型
  • 兼容 OpenAI 语音转文字接口,可改 base_url 直接调用
  • 内置 tiny 模型,可自行下载 base 到 large-v3 提升效果

容易踩的坑

源码部署需 Python 3.9~3.11,Windows 还需把 ffmpeg.exe 和 ffprobe.exe 放到项目目录。 除内置 tiny 外,其他模型要自行从 Releases 下载并解压到 models 目录。 启用 CUDA 需另装匹配的 cuDNN,否则可能启动后闪退;API 默认端口为 9977。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本20250805
  1. 20250805win-20250805最新正式版2025-08-05 · 2025-08-05 05:09 UTC

    Change

    Fix: 多线程识别转为单线程排队,避免爆显存 Fix: 中文语言环境下使用hf镜像替代 huggingface,在线下载模型 Fix: 前端界面下载text时后缀更改为 .txt Feat: 增加兼容 openai speech to text 接口,地址 http://127.0.0.1:9977/v1 支持返回 text/srt/json 格式

    完整包下载地址 1.6G/Download url:

    百度网盘: https://pan.baidu.com/s/1S5z3cSu2XGhQLk8trC_-Tw?pwd=2hvc

    GitHub地址: https://github.com/jianchang512/stt/releases/download/20250805/stt-20250805.7z


    使用方法

    解压到英文目录下,双击 start.exe, 在打开的页面中上传音频视频文件识别


  2. v0.940.12024-09-23 · 2024-09-23 18:42 UTC
    查看更新说明

    Change

    1. Fix api获取不到上传的文件
    2. 移除 vad配置,使用默认
    3. 更新 large-v3-turbo模型
    4. 添加语言自动判断
    5. 结束状态判断时错误
    6. 修复api多个同时调用只返回第一个的bug
    7. 修复distil模型提示不存在问题
    8. 修复显示问题
    9. 增加自定义huggingface模型功能

    完整包下载地址(含base模型)1.7GB/Download url:

    百度网盘: https://pan.baidu.com/s/1KGX31_rurBl9UQiuwaiMqg?pwd=a48t

    GitHub地址: https://github.com/jianchang512/stt/releases/download/v0.94/win-0.0.94.7z


    v0.1 升级补丁包地址/96MB:

    GitHub: https://github.com/jianchang512/stt/releases/download/v0.94/win-patchUpdate-0.1.7z


    使用方法

    解压到英文目录下,双击 start.exe, 在打开的页面中上传音频视频文件识别 extract to folder and doubleclick start.exe, wait unitl open webbrowser


    ffmpeg.exe下载

    如果你的计算机上没有ffmpeg,请下载这2个exe文件,和 start.exe放在同一位置

    https://github.com/jianchang512/stt/releases/download/0.0/ffmpeg.exe

    https://github.com/jianchang512/stt/releases/download/0.0/ffprobe.exe

    全部模型下载地址/Download models https://github.com/jianchang512/stt/releases/tag/0.0

  3. v0.93stt-v0.932024-02-19 · 2024-02-19 18:29 UTC
    查看更新说明

    Change

    1. 添加模型这次从 tiny-->large-v3
    2. 修复前端js超时问题 #29

    完整包下载地址(含base模型)1.7GB/Download url:

    百度网盘: https://pan.baidu.com/s/1rAKW7pBMLx4od9391wjtYw?pwd=xg4s

    Huggingface: https://huggingface.co/spaces/mortimerme/s4/resolve/main/win-stt-0.0.93.7z?download=true


    升级补丁包地址/30MB:

    百度网盘:https://pan.baidu.com/s/1Dqd1FNC0Cwe5KqD_5bNhqg?pwd=gj65

    Huggingface: https://huggingface.co/spaces/mortimerme/s4/resolve/main/win-stt-patch-0.0.93.7z?download=true


    使用方法

    解压到英文目录下,双击 start.exe, 在打开的页面中上传音频视频文件识别 extract to folder and doubleclick start.exe, wait unitl open webbrowser


    ffmpeg.exe下载

    如果你的计算机上没有ffmpeg,请下载这2个exe文件,和 start.exe放在同一位置

    https://github.com/jianchang512/stt/releases/download/v0.93/ffmpeg.exe

    https://github.com/jianchang512/stt/releases/download/v0.93/ffprobe.exe

    全部模型下载地址/Download models https://github.com/jianchang512/stt/releases/tag/0.0

  4. v0.91stt-v0.912024-01-26 · 2024-01-26 15:54 UTC
    查看更新说明

    Change

    add more param at the set.ini for whisper model

    下载地址(内含base模型)/Download url:

    百度网盘: https://pan.baidu.com/s/1oAeBvVcNv3HP2QWa3uiilg?pwd=efvc

    GitHub: https://github.com/jianchang512/stt/releases/download/v0.91/sttv-0.91.7z

    解压到英文目录下,双击 start.exe, 在打开的页面中上传音频视频文件识别 extract to folder and doubleclick start.exe, wait unitl open webbrowser


    模型下载地址/Download models https://github.com/jianchang512/stt/releases/tag/0.0

  5. v0.0.6stt-v0.0.62024-01-12 · 2024-01-12 14:58 UTC
    查看更新说明

    Change

    1. fixed bug #7
    2. 默认使用 cpu 运算,如果确定使用英伟达显卡,并且配置好了cuda环境,请修改 set.ini 中 devtype=cpu为 devtype=cuda,并重新启动,可使用cuda加速
    3. progressbar

    下载地址(内含base模型)/Download url:

    百度网盘: https://pan.baidu.com/s/1am6RNTwR9cfA3_EKwyTLxg?pwd=cvrd

    GitHub: https://github.com/jianchang512/stt/releases/download/v0.0.6/sttv0.0.6.7z

    解压到英文目录下,双击 start.exe, 在打开的页面中上传音频视频文件识别 extract to folder and doubleclick start.exe, wait unitl open webbrowser


    模型下载地址/Download models https://github.com/jianchang512/stt/releases/tag/0.0

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    中文简体 | English


    👑 捐助本项目


    语音识别转文字工具

    这是一个离线运行的本地语音识别转文字工具,基于 fast-whipser 开源模型,可将视频/音频中的人类声音识别并转为文字,可输出json格式、srt字幕带时间戳格式、纯文字格式。可用于自行部署后替代 openai 的语音识别接口或百度语音识别等,准确率基本等同openai官方api接口。

    fast-whisper 开源模型有 tiny/base/small/medium/large-v3, 内置 tiny 模型,tiny->large-v3识别效果越来越好,但所需计算机资源也更多,根据需要可自行下载后解压到 models 目录下即可。

    视频演示

    https://github.com/jianchang512/stt/assets/3378335/d716acb6-c20c-4174-9620-f574a7ff095d

    image

    预编译Win版使用方法/Linux和Mac源码部署

    1. 点击此处打开Releases页面下载预编译文件

    2. 下载后解压到某处,比如 E:/stt

    3. 双击 start.exe ,等待自动打开浏览器窗口即可

    4. 点击页面中的上传区域,在弹窗中找到想识别的音频或视频文件,或直接拖拽音频视频文件到上传区域,然后选择发生语言、文本输出格式、所用模型,点击“立即开始识别”,稍等片刻,底部文本框中会以所选格式显示识别结果

    5. 如果机器拥有英伟达GPU,并正确配置了CUDA环境,将自动使用CUDA加速

    源码部署(Linux/Mac/Window)

    1. 要求 python 3.9->3.11

    2. 创建空目录,比如 E:/stt, 在这个目录下打开 cmd 窗口,方法是地址栏中输入 cmd, 然后回车。

      使用git拉取源码到当前目录 git clone [email protected]:jianchang512/stt.git .

    3. 创建虚拟环境 python -m venv venv

    4. 激活环境,win下命令 %cd%/venv/scripts/activate,linux和Mac下命令 source ./venv/bin/activate

    5. 安装依赖: pip install -r requirements.txt,如果报版本冲突错误,请执行 pip install -r requirements.txt --no-deps ,如果希望支持cuda加速,继续执行代码 pip uninstall -y torch, pip install torch --index-url https://download.pytorch.org/whl/cu121

    6. win下解压 ffmpeg.7z,将其中的ffmpeg.exe和ffprobe.exe放在项目目录下, linux和mac 自行搜索 如何安装ffmpeg

    7. 下载模型压缩包,根据需要下载模型,下载后将压缩包里的文件夹放到项目根目录的 models 文件夹内

    8. 执行 python start.py ,等待自动打开本地浏览器窗口。

    Api接口

    接口地址: http://127.0.0.1:9977/api

    请求方法: POST

    请求参数:

    language: 语言代码:可选如下
    
    >
    > 中文:zh
    > 英语:en
    > 法语:fr
    > 德语:de
    > 日语:ja
    > 韩语:ko
    > 俄语:ru
    > 西班牙语:es
    > 泰国语:th
    > 意大利语:it
    > 葡萄牙语:pt
    > 越南语:vi
    > 阿拉伯语:ar
    > 土耳其语:tr
    >
    
    model: 模型名称,可选如下
    >
    > base 对应于 models/models--Systran--faster-whisper-base
    > small 对应于 models/models--Systran--faster-whisper-small
    > medium 对应于 models/models--Systran--faster-whisper-medium
    > large-v3 对应于 models/models--Systran--faster-whisper-large-v3
    >
    
    response_format: 返回的字幕格式,可选 text|json|srt
    
    file: 音视频文件,二进制上传
    

    Api 请求示例

        import requests
        # 请求地址
        url = "http://127.0.0.1:9977/api"
        # 请求参数  file:音视频文件,language:语言代码,model:模型,response_format:text|json|srt
        # 返回 code==0 成功,其他失败,msg==成功为ok,其他失败原因,data=识别后返回文字
        files = {"file": open("C:/Users/c1/Videos/2.wav", "rb")}
        data={"language":"zh","model":"base","response_format":"json"}
        response = requests.request("POST", url, timeout=600, data=data,files=files)
        print(response.json())
    

    兼容 openai 语音转文字接口

    示例代码

    # openai兼容格式
    from openai import OpenAI
    
    client = OpenAI(api_key='123',base_url='http://127.0.0.1:9977/v1')
    audio_file= open("/users/c1/videos/60.wav", "rb")
    
    transcription = client.audio.transcriptions.create(
        model="tiny", 
        file=audio_file,
        response_format="text" # 支持 text 、srt 格式,json格式会返回srt字幕解析后的json数据
    )
    
    print(transcription.text)
    
    

    CUDA 加速支持

    安装CUDA工具 详细安装方法

    如果你的电脑拥有 Nvidia 显卡,先升级显卡驱动到最新,然后去安装对应的 CUDA Toolkit 和 cudnn for CUDA11.X。

    安装完成成,按Win + R,输入 cmd然后回车,在弹出的窗口中输入nvcc --version,确认有版本信息显示,类似该图 image

    然后继续输入nvidia-smi,确认有输出信息,并且能看到cuda版本号,类似该图 image

    然后执行 `python testcuda.py`,如果提示成功,说明安装正确,否则请仔细检查重新安装
    
    默认使用 cpu 运算,如果确定使用英伟达显卡,并且配置好了cuda环境,请修改 set.ini 中 `devtype=cpu`为 `devtype=cuda`,并重新启动,可使用cuda加速
    

    注意事项

    1. 如果没有英伟达显卡或未配置好CUDA环境,不要使用 large/large-v3 模型,可能导致内存耗尽死机

    2. 中文在某些情况下会输出繁体字

    3. 有时会遇到“cublasxx.dll不存在”的错误,此时需要下载 cuBLAS,然后将dll文件复制到系统目录下,点击下载 cuBLAS,解压后将里面的dll文件复制到 C:/Windows/System32下

    4. 如果控制台出现"[W:onnxruntime:Default, onnxruntime_pybind_state.cc:1983 onnxruntime::python::CreateInferencePybindStateModule] Init provider bridge failed.", 可忽略,不影响使用

    5. 默认使用 cpu 运算,如果确定使用英伟达显卡,并且配置好了cuda环境,请修改 set.ini 中 devtype=cpu为 devtype=cuda,并重新启动,可使用cuda加速

    6. 尚未执行完毕就闪退

    如果启用了cuda并且电脑已安装好了cuda环境,但没有手动安装配置过cudnn,那么会出现该问题,去安装和cuda匹配的cudnn。比如你安装了cuda12.3,那么就需要下载cudnn for cuda12.x压缩包,然后解压后里面的3个文件夹复制到cuda安装目录下。具体教程参考 https://juejin.cn/post/7318704408727519270

    如果cudnn按照教程安装好了仍闪退,那么极大概率是GPU显存不足,可以改为使用 medium模型,显存不足8G时,尽量避免使用largev-3模型,尤其是视频大于20M时,否则可能显存不足而崩溃

    相关联项目

    视频翻译配音工具:翻译字幕并配音

    声音克隆工具:用任意音色合成语音

    人声背景乐分离:极简的人声和背景音乐分离工具,本地化网页操作

    致谢

    本项目主要依赖的其他项目

    1. https://github.com/SYSTRAN/faster-whisper
    2. https://github.com/pallets/flask
    3. https://ffmpeg.org/
    4. https://layui.dev