{"data":{"slug":"jianchang512-stt","name":"stt","tagline":"Voice Recognition to Text Tool / 一个离线运行的本地音视频转字幕工具，输出json、srt字幕、纯文字格式","github_url":"https://github.com/jianchang512/stt","owner":"jianchang512","repo":"stt","owner_avatar_url":"https://avatars.githubusercontent.com/u/3378335?v=4","primary_language":"Python","stars":4664,"forks":494,"topics":["speech","speech-recognition","speech-to-text","stt"],"archived":false,"github_pushed_at":"2026-01-22T08:38:53+00:00","maintenance_label":"Slowing","url":"https://www.graphcanon.com/tools/jianchang512-stt","markdown_url":"https://www.graphcanon.com/tools/jianchang512-stt.md","api_url":"https://www.graphcanon.com/api/graphcanon/tools/jianchang512-stt","graph_url":"https://www.graphcanon.com/api/graphcanon/graph?tool=jianchang512-stt","description":"Voice Recognition to Text Tool / 一个离线运行的本地音视频转字幕工具，输出json、srt字幕、纯文字格式","homepage_url":"https://pyvideotrans.com","license":"GPL-3.0","open_issues":100,"watchers":17,"ai_summary":null,"readme_excerpt":"<div align=\"center\">\n\n**中文简体** | [English](./docs/en/README_EN.md)\n\n</div>\n\n---\n\n<div align=\"center\">\n\n[👑 捐助本项目](https://pyvideotrans.com/about)\n\n</div>\n\n---\n\n\n# 语音识别转文字工具\n\n这是一个离线运行的本地语音识别转文字工具，基于 fast-whipser 开源模型，可将视频/音频中的人类声音识别并转为文字，可输出json格式、srt字幕带时间戳格式、纯文字格式。可用于自行部署后替代 openai 的语音识别接口或百度语音识别等，准确率基本等同openai官方api接口。\n\n\nfast-whisper 开源模型有 tiny/base/small/medium/large-v3, 内置 tiny 模型，tiny->large-v3识别效果越来越好，但所需计算机资源也更多，根据需要可自行下载后解压到 models 目录下即可。\n\n\n\n# 视频演示\n\n\nhttps://github.com/jianchang512/stt/assets/3378335/d716acb6-c20c-4174-9620-f574a7ff095d\n\n\n\n\n\n\n\n# 预编译Win版使用方法/Linux和Mac源码部署\n\n1. [点击此处打开Releases页面下载](https://github.com/jianchang512/stt/releases)预编译文件\n\n2. 下载后解压到某处，比如 E:/stt\n\n3. 双击 start.exe ，等待自动打开浏览器窗口即可\n\n4. 点击页面中的上传区域，在弹窗中找到想识别的音频或视频文件，或直接拖拽音频视频文件到上传区域，然后选择发生语言、文本输出格式、所用模型，点击“立即开始识别”，稍等片刻，底部文本框中会以所选格式显示识别结果\n\n5. 如果机器拥有英伟达GPU，并正确配置了CUDA环境，将自动使用CUDA加速\n\n\n# 源码部署(Linux/Mac/Window)\n\n0. 要求 python 3.9->3.11\n\n1. 创建空目录，比如 E:/stt, 在这个目录下打开 cmd 窗口，方法是地址栏中输入 `cmd`, 然后回车。\n\n\t使用git拉取源码到当前目录 ` git clone git@github.com:jianchang512/stt.git . `\n\n2. 创建虚拟环境 `python -m venv venv`\n\n3. 激活环境，win下命令 `%cd%/venv/scripts/activate`，linux和Mac下命令 `source ./venv/bin/activate`\n\n4. 安装依赖: `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`\n\n5. win下解压 ffmpeg.7z，将其中的`ffmpeg.exe`和`ffprobe.exe`放在项目目录下, linux和mac 自行搜索 如何安装ffmpeg\n\n6. [下载模型压缩包](https://github.com/jianchang512/stt/releases/tag/0.0)，根据需要下载模型，下载后将压缩包里的文件夹放到项目根目录的 models 文件夹内\n\n7. 执行  `python  start.py `，等待自动打开本地浏览器窗口。\n\n\n# Api接口\n\n接口地址: http://127.0.0.1:9977/api\n\n请求方法: POST\n\n请求参数:\n\n    language: 语言代码:可选如下\n\n    >\n    > 中文：zh\n    > 英语：en\n    > 法语：fr\n    > 德语：de\n    > 日语：ja\n    > 韩语：ko\n    > 俄语：ru\n    > 西班牙语：es\n    > 泰国语：th\n    > 意大利语：it\n    > 葡萄牙语：pt\n    > 越南语：vi\n    > 阿拉伯语：ar\n    > 土耳其语：tr\n    >\n\n    model: 模型名称，可选如下\n    >\n    > base 对应于 models/models--Systran--faster-whisper-base\n    > small 对应于 models/models--Systran--faster-whisper-small\n    > medium 对应于 models/models--Systran--faster-whisper-medium\n    > large-v3 对应于 models/models--Systran--faster-whisper-large-v3\n    >\n\n    response_format: 返回的字幕格式，可选 text|json|srt\n\n    file: 音视频文件，二进制上传\n\nApi 请求示例\n\n```python\n    import requests\n    # 请求地址\n    url = \"http://127.0.0.1:9977/api\"\n    # 请求参数  file:音视频文件，language：语言代码，model：模型，response_format:text|json|srt\n    # 返回 code==0 成功，其他失败，msg==成功为ok，其他失败原因，data=识别后返回文字\n    files = {\"file\": open(\"C:/Users/c1/Videos/2.wav\", \"rb\")}\n    data={\"language\":\"zh\",\"model\":\"base\",\"response_format\":\"json\"}\n    response = requests.request(\"POST\", url, timeout=600, data=data,files=files)\n    print(response.json())\n```\n\n# 兼容 openai 语音转文字接口\n\n示例代码\n```\n# openai兼容格式\nfrom openai import OpenAI\n\nclient = OpenAI(api_key='123',base_url='http://127.0.0.1:9977/v1')\naudio_file= open(\"/users/c1/videos/60.wav\", \"rb\")\n\ntranscription = client.audio.transcriptions.create(\n    model=\"tiny\", \n    file=audio_file,\n    response_format=\"text\" # 支持 text 、srt 格式，json格式会返回srt字幕解析后的json数据\n)\n\nprint(transcription.text)\n\n```\n\n\n# CUDA 加速支持\n\n**安装CUDA工具** [详细安装方法](https://juejin.cn/post/7318704408727519270)\n\n如果你的电脑拥有 Nvidia 显卡，先升级显卡驱动到最新，然后去安装对应的 \n   [CUDA Toolkit](https://developer.nvidia.com/cuda-downloads)  和  [cudnn for CUDA11.X](https://developer.nvidia.com/rdp/cudnn-archive)。\n   \n   安装完成成，按`Win + R`,输入 `cmd`然后回车，在弹出的窗口中输入`nvcc --version`,确认有版本信息显示，类似该图\n   \n\n   然后继续输入`nvidia-smi`,确认有输出信息，并且能看到cuda版本号，类似该图\n   \n\n    然后执行 `python testcuda.py`，如果提示成功，说明安装正确，否则请仔细检查重新安装\n    \n    默认使用 cpu 运算，如果确定使用英伟达显卡，并且配置好了cuda环境，请修改 set.ini 中 `devtype=cpu`为 `devtype=cuda`,并重新启动，可使用cuda加速\n\n# 注意事项\n\n0. 如果没有英伟达显卡或未配置好CUDA环境，不要使用 large/large-v3 模型，可能导致内存耗尽死机\n1. 中文在某些情况下会输出繁体字\n2. 有时会遇到“cublasxx.dll不存在”的错误，此时需要下载 cuBLAS，然后将dll文件复制到系统目录下，[点击下载 cuBLAS](https://github.com/jianchang512/stt/releases/download/0.0/cuBLAS_win.7z)，解压后将里面的dll文件复制到 C:/Windows/System32下\n3. 如果控制台出现\"[W:onnxruntime:Default, onnxruntime_pybind_state.cc:1983 onn","github_created_at":"2023-12-28T16:02:55+00:00","created_at":"2026-07-11T12:15:36.870667+00:00","updated_at":"2026-07-11T12:15:56.334321+00:00","categories":[{"slug":"model-training","name":"Model Training","url":"https://www.graphcanon.com/categories/model-training","markdown_url":"https://www.graphcanon.com/categories/model-training.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/model-training"},{"slug":"speech-audio","name":"Speech & Audio","url":"https://www.graphcanon.com/categories/speech-audio","markdown_url":"https://www.graphcanon.com/categories/speech-audio.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/speech-audio"},{"slug":"inference-serving","name":"Inference & Serving","url":"https://www.graphcanon.com/categories/inference-serving","markdown_url":"https://www.graphcanon.com/categories/inference-serving.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/inference-serving"}],"tags":[{"slug":"speech","name":"speech"},{"slug":"speech-to-text","name":"speech-to-text"},{"slug":"python","name":"python"},{"slug":"stt","name":"stt"},{"slug":"speech-recognition","name":"speech-recognition"}],"trust":{"provenance":{"is_fork":false,"github_id":736697367,"owner_type":"User","methodology":"github_public_v1","parent_repo":null,"near_duplicate_slugs":[]},"computed_at":"2026-07-11T12:15:37.549Z","maintenance":{"label":"Slowing","score":36,"methodology":"github_public_v1","releases_90d":0,"days_since_push":170,"last_release_at":"2025-08-05T05:09:16Z"},"security_summary":{"status":"findings","scanner":"osv@v1","low_count":21,"high_count":2,"last_scan_at":"2026-07-11T12:15:43.983Z","medium_count":3,"scan_profile":"deps","critical_count":1}},"capability_facts":{"scan":{"source":"repo_scan","observed_at":"2026-07-11T12:15:41.319Z"},"languages":{"value":["python"],"source":"github.language","observed_at":"2026-07-11T12:15:41.319Z"},"license_spdx":{"value":"GPL-3.0","source":"github.license","observed_at":"2026-07-11T12:15:41.319Z"}}}}