voxprep 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. voxprep-0.1.0/.gitignore +13 -0
  2. voxprep-0.1.0/CHANGELOG.md +18 -0
  3. voxprep-0.1.0/CONTRIBUTING.md +77 -0
  4. voxprep-0.1.0/LICENSE +21 -0
  5. voxprep-0.1.0/PKG-INFO +267 -0
  6. voxprep-0.1.0/README.md +234 -0
  7. voxprep-0.1.0/README_ZH.md +214 -0
  8. voxprep-0.1.0/benchmarks/bench_correctness.py +159 -0
  9. voxprep-0.1.0/docs/agents.md +125 -0
  10. voxprep-0.1.0/examples/ask.py +31 -0
  11. voxprep-0.1.0/pyproject.toml +85 -0
  12. voxprep-0.1.0/skills/voxprep/SKILL.md +49 -0
  13. voxprep-0.1.0/src/voxprep/__init__.py +42 -0
  14. voxprep-0.1.0/src/voxprep/agents.py +64 -0
  15. voxprep-0.1.0/src/voxprep/backends/__init__.py +91 -0
  16. voxprep-0.1.0/src/voxprep/backends/funasr.py +78 -0
  17. voxprep-0.1.0/src/voxprep/backends/openai.py +135 -0
  18. voxprep-0.1.0/src/voxprep/backends/parakeet.py +303 -0
  19. voxprep-0.1.0/src/voxprep/backends/sensevoice.py +286 -0
  20. voxprep-0.1.0/src/voxprep/chunker.py +421 -0
  21. voxprep-0.1.0/src/voxprep/cli.py +469 -0
  22. voxprep-0.1.0/src/voxprep/diagnose.py +130 -0
  23. voxprep-0.1.0/src/voxprep/downloads.py +105 -0
  24. voxprep-0.1.0/src/voxprep/fbank.py +155 -0
  25. voxprep-0.1.0/src/voxprep/io.py +245 -0
  26. voxprep-0.1.0/src/voxprep/mcp_server.py +214 -0
  27. voxprep-0.1.0/src/voxprep/models/SILERO_VAD_LICENSE +21 -0
  28. voxprep-0.1.0/src/voxprep/models/__init__.py +0 -0
  29. voxprep-0.1.0/src/voxprep/models/silero_vad_16k_op15.onnx +0 -0
  30. voxprep-0.1.0/src/voxprep/presets.py +208 -0
  31. voxprep-0.1.0/src/voxprep/py.typed +0 -0
  32. voxprep-0.1.0/src/voxprep/reference.py +220 -0
  33. voxprep-0.1.0/src/voxprep/stitch.py +392 -0
  34. voxprep-0.1.0/src/voxprep/transcript.py +408 -0
  35. voxprep-0.1.0/src/voxprep/vad.py +190 -0
  36. voxprep-0.1.0/tests/conftest.py +61 -0
  37. voxprep-0.1.0/tests/data/speech_en.wav +0 -0
  38. voxprep-0.1.0/tests/test_agents.py +36 -0
  39. voxprep-0.1.0/tests/test_chunker.py +121 -0
  40. voxprep-0.1.0/tests/test_downloads.py +76 -0
  41. voxprep-0.1.0/tests/test_io.py +90 -0
  42. voxprep-0.1.0/tests/test_mcp.py +191 -0
  43. voxprep-0.1.0/tests/test_parakeet.py +171 -0
  44. voxprep-0.1.0/tests/test_presets_inspect.py +83 -0
  45. voxprep-0.1.0/tests/test_reference.py +79 -0
  46. voxprep-0.1.0/tests/test_sensevoice.py +107 -0
  47. voxprep-0.1.0/tests/test_stitch_backends.py +526 -0
  48. voxprep-0.1.0/tests/test_transcript.py +210 -0
  49. voxprep-0.1.0/tests/test_vad.py +73 -0
@@ -0,0 +1,13 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ # API keys for local testing (never commit)
13
+ .env
@@ -0,0 +1,18 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ First release.
6
+
7
+ - `voxprep subtitle` / `transcribe`: any audio or video to SRT, VTT, Markdown, text, JSON or a
8
+ Claude document with citations, on the original timeline.
9
+ - Speech models: Groq and OpenAI when a key is set, otherwise a built-in local model on the
10
+ CPU (NVIDIA Parakeet for English; SenseVoice for Mandarin, Cantonese, Japanese and Korean).
11
+ No PyTorch and no system FFmpeg.
12
+ - `prepare` / `stitch` for any other model: split at pauses to fit its limits, then put the
13
+ answers back on one timeline.
14
+ - Fixes for what speech models get wrong: skipped speech is sent again, text invented over
15
+ silence is dropped, what is still missing is reported in `possible_gaps`.
16
+ - For AI assistants: an MCP server (`voxprep mcp`), a Claude Code plugin, `install-skill`,
17
+ and `--json` on every command.
18
+ - `inspect`, `presets`, `ref-clip`.
@@ -0,0 +1,77 @@
1
+ # Contributing to voxprep
2
+
3
+ Bug reports, new model presets and new backends are all welcome. Small pull requests get
4
+ merged fastest.
5
+
6
+ ## Set up
7
+
8
+ ```bash
9
+ git clone https://github.com/LL333111/voxprep
10
+ cd voxprep
11
+ uv sync # creates .venv with the dev tools
12
+ uv run pytest # about a minute
13
+ uv run ruff check . && uv run ruff format --check .
14
+ ```
15
+
16
+ No API key is needed for the tests: backends are tested with fake clients.
17
+
18
+ ## Report a transcription problem
19
+
20
+ The most useful report has:
21
+
22
+ - the command you ran, with `--json`, and what it printed (it has no audio or text in it);
23
+ - what was wrong: a missing sentence, a subtitle at the wrong time, text that was never said;
24
+ - `voxprep inspect FILE --json` for the file;
25
+ - if you can share it, a short clip that shows the problem. Don't post private recordings.
26
+
27
+ ## Add a model preset
28
+
29
+ A preset is the limits of one model: how big, how long, what format. Most models need nothing
30
+ else. Add a `TranscribePreset` to `TRANSCRIBE` in
31
+ [`src/voxprep/presets.py`](src/voxprep/presets.py):
32
+
33
+ ```python
34
+ TranscribePreset(
35
+ name="acme-asr",
36
+ description="Acme speech-to-text",
37
+ fmt="flac", # wav / flac / mp3 / opus
38
+ max_bytes=24 * MB, # leave a little under the official limit
39
+ max_seconds=600.0, # if the model has a duration cap
40
+ source="https://docs.acme.example/speech-to-text", # where the numbers are from
41
+ verified="2026-12-05", # the day you checked them
42
+ ),
43
+ ```
44
+
45
+ `source` and `verified` are required: limits change, and this is how the next person knows how
46
+ old a number is. Add the model to the table in `README.md` and `README_ZH.md`.
47
+
48
+ ## Add a backend
49
+
50
+ A backend calls a model for each chunk. It is any object with:
51
+
52
+ ```python
53
+ class AcmeBackend:
54
+ name = "acme"
55
+ preset = "acme-asr" # the preset its chunks follow
56
+
57
+ def transcribe(self, chunk, prompt=None):
58
+ # chunk.to_bytes(), chunk.filename, chunk.mime_type
59
+ # return anything voxprep.stitch reads: a dict with "segments" (start, end, text in
60
+ # chunk-local seconds), SRT / VTT text, or plain text
61
+ ...
62
+ ```
63
+
64
+ It works with `vp.transcribe(file, via=AcmeBackend())` without touching voxprep. To ship it
65
+ in voxprep, put it in `src/voxprep/backends/`, register the name in
66
+ `backends/__init__.py`, keep the model's SDK an optional extra in `pyproject.toml`, and test
67
+ it with a fake client as `tests/test_stitch_backends.py` does. Optional attributes:
68
+ `remote` (the service audio is uploaded to), `gives_timestamps()` (False for text-only
69
+ models), `hint` (advice for the user after a run).
70
+
71
+ ## Style
72
+
73
+ - Python 3.11+, `ruff` for lint and format, line length 100.
74
+ - The core install stays light: numpy, PyAV, onnxruntime. Anything else is an optional extra.
75
+ - A fix comes with a test that fails without it.
76
+ - If you change an MCP tool, regenerate the plugin's tool list:
77
+ `VOXPREP_WRITE_TOOLS=1 uv run pytest tests/test_mcp.py`.
voxprep-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 LL333111
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
voxprep-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,267 @@
1
+ Metadata-Version: 2.5
2
+ Name: voxprep
3
+ Version: 0.1.0
4
+ Summary: Let AI hear any audio or video: subtitles and timestamped transcripts on the original timeline, with a local model built in. No API key, no PyTorch, no system FFmpeg.
5
+ Author: LL333111
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Keywords: asr,audio,claude,llm,mcp,parakeet,speech-to-text,subtitles,transcription,vad,video,whisper
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
17
+ Requires-Python: >=3.11
18
+ Requires-Dist: av>=14.0
19
+ Requires-Dist: numpy>=1.26
20
+ Requires-Dist: onnxruntime>=1.20
21
+ Provides-Extra: funasr
22
+ Requires-Dist: funasr>=1.1; extra == 'funasr'
23
+ Requires-Dist: torch>=2.1; extra == 'funasr'
24
+ Requires-Dist: torchaudio>=2.1; extra == 'funasr'
25
+ Provides-Extra: groq
26
+ Requires-Dist: openai>=1.50; extra == 'groq'
27
+ Provides-Extra: mcp
28
+ Requires-Dist: mcp>=2.3; extra == 'mcp'
29
+ Requires-Dist: openai>=1.50; extra == 'mcp'
30
+ Provides-Extra: openai
31
+ Requires-Dist: openai>=1.50; extra == 'openai'
32
+ Description-Content-Type: text/markdown
33
+
34
+ # voxprep
35
+
36
+ <!-- mcp-name: io.github.LL333111/voxprep -->
37
+
38
+ **Let your AI hear.** Subtitles and timestamped transcripts from any audio or video, and
39
+ answers that cite the exact second. No API key, no PyTorch, no FFmpeg install.
40
+
41
+ [![PyPI](https://img.shields.io/pypi/v/voxprep)](https://pypi.org/project/voxprep/)
42
+ [![Python](https://img.shields.io/pypi/pyversions/voxprep)](https://pypi.org/project/voxprep/)
43
+ [![CI](https://github.com/LL333111/voxprep/actions/workflows/ci.yml/badge.svg)](https://github.com/LL333111/voxprep/actions/workflows/ci.yml)
44
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
45
+
46
+ [中文](README_ZH.md)
47
+
48
+ ```bash
49
+ pip install voxprep
50
+ voxprep subtitle talk.mp4 # writes talk.srt
51
+ voxprep transcribe talk.mp4 -f md # writes talk.transcript.md, for your AI to read
52
+ ```
53
+
54
+ That's it. The speech model runs on your CPU; nothing is uploaded and there is nothing to
55
+ sign up for.
56
+
57
+ ![voxprep transcribes a 35-minute NASA podcast, then Claude answers a question about it and shows when each part was said](https://raw.githubusercontent.com/LL333111/voxprep/main/docs/demo.gif)
58
+
59
+ A 35-minute NASA podcast becomes a transcript; Claude answers from it, and every sentence of
60
+ the answer comes with the moment it was said. Real output; the script is
61
+ [examples/ask.py](examples/ask.py).
62
+
63
+ Measured on more than 70 real recordings before release:
64
+
65
+ - **Half the errors on recordings with long pauses** (9.8% → 4.3% word error rate): speech
66
+ Whisper skips is sent again, and the "Thank you." it invents over silence is dropped.
67
+ - **Subtitles start 0.07 s from the truth** (median), however many pieces the file was cut into.
68
+ - **A 3-hour file is ready to send in 3 minutes** on about 1 GB of memory.
69
+
70
+ ## Give it to your AI assistant
71
+
72
+ Claude, Cursor and other assistants can't listen to a file. With voxprep they can: set it up
73
+ once, then ask "what did they decide in meeting.mp4?"
74
+
75
+ **Claude Code** (needs [uv](https://docs.astral.sh/uv/)):
76
+
77
+ ```text
78
+ /plugin marketplace add LL333111/voxprep
79
+ /plugin install voxprep@voxprep
80
+ ```
81
+
82
+ **Claude Desktop, Cursor, Windsurf and any other MCP client**: add this to the MCP config.
83
+
84
+ ```json
85
+ {
86
+ "mcpServers": {
87
+ "voxprep": { "command": "uvx", "args": ["--from", "voxprep[mcp]", "voxprep", "mcp"] }
88
+ }
89
+ }
90
+ ```
91
+
92
+ **Codex, Gemini CLI and anything that reads a rules file**:
93
+
94
+ ```bash
95
+ pip install voxprep
96
+ voxprep install-skill # Claude Code: adds the skill to ~/.claude/skills/
97
+ voxprep install-skill --print # everything else: paste the output into AGENTS.md
98
+ ```
99
+
100
+ Every command takes `--json`. Setup details and first-run notes are in
101
+ [docs/agents.md](docs/agents.md).
102
+
103
+ ## Answers that point to the second
104
+
105
+ Hand Claude a transcript and each citation in its answer maps back to a time in the recording.
106
+ On our tests it landed on the right sentence 100% of the time in English and 90% in Chinese.
107
+
108
+ ```python
109
+ import anthropic
110
+
111
+ msg = anthropic.Anthropic().messages.create(
112
+ model="claude-opus-5-5",
113
+ max_tokens=2000,
114
+ messages=[{"role": "user", "content": [
115
+ t.to_claude(title="Weekly meeting"), # document block with citations on
116
+ {"type": "text", "text": "What did we decide about the launch date?"},
117
+ ]}],
118
+ )
119
+ for block in msg.content:
120
+ if block.type == "text":
121
+ print(block.text)
122
+ for c in block.citations or []:
123
+ start, end = t.locate(c) # seconds in the recording
124
+ print(f" at {start:.0f}s")
125
+ ```
126
+
127
+
128
+ For any other chat model:
129
+
130
+ ```python
131
+ t = vp.transcribe("meeting.mp4")
132
+ t.to_markdown() # "[00:12:41] text" lines
133
+ t.estimate_tokens() # will it fit in the context window?
134
+ ```
135
+
136
+ ## What it does for you
137
+
138
+ - **Reads any file.** MP4, MKV, MOV, M4A, MP3, Opus, FLAC, WAV, 5.1 audio, broken downloads:
139
+ anything FFmpeg can read, with no FFmpeg to install.
140
+ - **Cuts only where nobody is talking.** A file over a model's limit is split in a pause found
141
+ by the Silero voice-activity model (in non-stop speech, at the quietest moment).
142
+ - **Keeps one timeline.** Every piece goes back on the source timeline. Split files score
143
+ within a point of files sent whole.
144
+ - **Fixes what speech models get wrong.** Skipped speech is sent again on its own, invented
145
+ text over silence and music is dropped, and whatever is still missing is listed in
146
+ `possible_gaps` instead of being papered over.
147
+ - **Writes what you need.** SRT, VTT, timestamped Markdown, plain text, JSON, or a Claude
148
+ document with citations.
149
+ - **Stays light.** numpy, PyAV and onnxruntime. About 200 MB installed, on Windows, macOS and
150
+ Linux, Python 3.11+.
151
+
152
+ ## Choosing a speech model
153
+
154
+ `voxprep subtitle talk.mp4` picks one for you:
155
+
156
+ | You have | voxprep uses | Good to know |
157
+ | --- | --- | --- |
158
+ | Nothing | NVIDIA Parakeet, on your CPU | 6.6% word errors on a 20-minute talk, about 5x real time on a laptop. Downloaded once (660 MB). Free and offline |
159
+ | `GROQ_API_KEY` ([free](https://console.groq.com/keys)) | Groq Whisper | The fastest: about a minute per hour of audio. 5.8% on the same talk |
160
+ | `OPENAI_API_KEY` | OpenAI gpt-transcribe | For the tightest subtitle timing add `--model whisper-1` |
161
+
162
+ ```bash
163
+ pip install "voxprep[groq]" # adds the client for Groq and OpenAI
164
+ ```
165
+
166
+ - `--via groq|openai|local` picks one yourself. With a key set, the audio is sent to that
167
+ service; `--via local` (or `VOXPREP_VIA=local`) keeps every recording on your computer.
168
+ - The local model is English. For Mandarin, Cantonese, Japanese or Korean add `--language zh`
169
+ (or `yue`, `ja`, `ko`) and voxprep uses SenseVoice instead (240 MB). For other languages use
170
+ Groq or OpenAI; voxprep notices within the first minute and tells you.
171
+ - voxprep says so when another model would do better. `VOXPREP_QUIET=1` turns the tips off.
172
+
173
+ ## Bring your own model
174
+
175
+ voxprep prepares the audio, you call any model you like, and voxprep puts the answers back
176
+ together:
177
+
178
+ ```python
179
+ import voxprep as vp
180
+
181
+ result = vp.prepare("call.m4a", target="openai") # or max_mb=..., max_seconds=..., fmt=...
182
+ texts = [my_model(chunk.to_bytes()) for chunk in result.chunks]
183
+ vp.stitch(result, texts).refine().to_srt("call.srt")
184
+ ```
185
+
186
+ `stitch` reads whatever comes back: OpenAI-style JSON with segments, SRT, VTT, or plain text.
187
+ Plain text without timestamps is spread over the speech voxprep detected in that chunk.
188
+
189
+ Same thing from the command line:
190
+
191
+ ```bash
192
+ voxprep prepare talk.mp4 --for custom --max-mb 10 --max-sec 300 --format wav -o chunks
193
+ # ...send chunks/chunk_000.wav etc. to your model, save answers as chunks/chunk_000.txt...
194
+ voxprep stitch chunks -o talk.srt
195
+ ```
196
+
197
+ More:
198
+
199
+ ```bash
200
+ voxprep inspect talk.mp4 # duration, format, silence, which models take it as is
201
+ voxprep presets # every preset and its limits
202
+ voxprep ref-clip podcast.mp4 --for f5 # cleanest 3-12 s of one voice, for TTS voice cloning
203
+ ```
204
+
205
+ ## Supported models
206
+
207
+ | Preset | Model | Limit voxprep keeps to |
208
+ | --- | --- | --- |
209
+ | `openai` | OpenAI transcription (gpt-transcribe, whisper-1, gpt-4o-*-transcribe) | 24 MB |
210
+ | `groq` | Groq Whisper | 24 MB; avoids chunks under 10 s (billed as 10 s) |
211
+ | `gemini` | Gemini audio, inline | 14 MB; 5-minute pieces for accurate timestamps |
212
+ | `parakeet` | NVIDIA Parakeet TDT (the built-in English model) | 20 s |
213
+ | `sensevoice` | SenseVoice / FunASR | 28 s |
214
+ | `qwen3-asr-flash` | Qwen3-ASR-Flash | 9.5 MB, 290 s |
215
+
216
+
217
+ Anything else: `--for custom` with your own `--max-mb`, `--max-sec`, `--rate` and `--format`.
218
+ `ref-clip` has presets for `f5`, `cosyvoice`, `qwen3-tts` and `generic`.
219
+
220
+ ## Tested on real audio
221
+
222
+ Before this release, more than 70 recordings went through the whole pipeline with Groq, OpenAI,
223
+ Gemini and the built-in local models: podcasts, meetings, phone-quality calls, music and café
224
+ noise under speech, clipped and very quiet audio, and files up to 3 hours, in English, Mandarin
225
+ and Cantonese.
226
+
227
+ The unit tests and a correctness benchmark (every chunk under its limit, every cut in a pause,
228
+ stitched times within 1 ms) run in CI on Windows, macOS and Linux, and CI downloads the local
229
+ models and transcribes with them on all three:
230
+
231
+ ```bash
232
+ uv run pytest
233
+ uv run python benchmarks/bench_correctness.py
234
+ ```
235
+
236
+ ## Compared with
237
+
238
+ - **A script with pydub and a loop**: needs system FFmpeg, and you still look up each API's
239
+ limits, fix the timestamps and find the sentences the model dropped.
240
+ - **faster-whisper / WhisperX**: they run Whisper on your own machine, best with a GPU. voxprep
241
+ is the layer around any model: hosted APIs, your own, or its built-in CPU model, with the
242
+ same fixes and the same output formats for all of them.
243
+ - **silero-vad**: the same voice-activity model, but voxprep runs it on onnxruntime, so there
244
+ is no PyTorch to install.
245
+
246
+ ## Not yet
247
+
248
+ - Speaker labels (who said what).
249
+ - A local model for languages other than English, Mandarin, Cantonese, Japanese and Korean.
250
+ - Reading straight from a URL: download the file first.
251
+
252
+ Missing something? [Open an issue](https://github.com/LL333111/voxprep/issues) or see
253
+ [CONTRIBUTING.md](CONTRIBUTING.md); a new model is usually one small preset.
254
+
255
+ ## License
256
+
257
+ MIT. Ships Silero VAD v6 (MIT). PyAV wheels include FFmpeg libraries (LGPL).
258
+
259
+ The built-in local models are not part of the package and are not MIT. voxprep downloads
260
+ them on first use, as converted to ONNX by [sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx):
261
+
262
+ - English: [Parakeet-TDT-0.6B-v2](https://huggingface.co/nvidia/parakeet-tdt-0.6b-v2) by NVIDIA,
263
+ [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), quantised to int8. NVIDIA does not
264
+ endorse voxprep.
265
+ - Mandarin, Cantonese, Japanese, Korean: [SenseVoiceSmall](https://huggingface.co/FunAudioLLM/SenseVoiceSmall)
266
+ by FunAudioLLM / Alibaba Group, under the
267
+ [FunASR Model Open Source License Agreement](https://github.com/modelscope/FunASR/blob/main/MODEL_LICENSE).
@@ -0,0 +1,234 @@
1
+ # voxprep
2
+
3
+ <!-- mcp-name: io.github.LL333111/voxprep -->
4
+
5
+ **Let your AI hear.** Subtitles and timestamped transcripts from any audio or video, and
6
+ answers that cite the exact second. No API key, no PyTorch, no FFmpeg install.
7
+
8
+ [![PyPI](https://img.shields.io/pypi/v/voxprep)](https://pypi.org/project/voxprep/)
9
+ [![Python](https://img.shields.io/pypi/pyversions/voxprep)](https://pypi.org/project/voxprep/)
10
+ [![CI](https://github.com/LL333111/voxprep/actions/workflows/ci.yml/badge.svg)](https://github.com/LL333111/voxprep/actions/workflows/ci.yml)
11
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
12
+
13
+ [中文](README_ZH.md)
14
+
15
+ ```bash
16
+ pip install voxprep
17
+ voxprep subtitle talk.mp4 # writes talk.srt
18
+ voxprep transcribe talk.mp4 -f md # writes talk.transcript.md, for your AI to read
19
+ ```
20
+
21
+ That's it. The speech model runs on your CPU; nothing is uploaded and there is nothing to
22
+ sign up for.
23
+
24
+ ![voxprep transcribes a 35-minute NASA podcast, then Claude answers a question about it and shows when each part was said](https://raw.githubusercontent.com/LL333111/voxprep/main/docs/demo.gif)
25
+
26
+ A 35-minute NASA podcast becomes a transcript; Claude answers from it, and every sentence of
27
+ the answer comes with the moment it was said. Real output; the script is
28
+ [examples/ask.py](examples/ask.py).
29
+
30
+ Measured on more than 70 real recordings before release:
31
+
32
+ - **Half the errors on recordings with long pauses** (9.8% → 4.3% word error rate): speech
33
+ Whisper skips is sent again, and the "Thank you." it invents over silence is dropped.
34
+ - **Subtitles start 0.07 s from the truth** (median), however many pieces the file was cut into.
35
+ - **A 3-hour file is ready to send in 3 minutes** on about 1 GB of memory.
36
+
37
+ ## Give it to your AI assistant
38
+
39
+ Claude, Cursor and other assistants can't listen to a file. With voxprep they can: set it up
40
+ once, then ask "what did they decide in meeting.mp4?"
41
+
42
+ **Claude Code** (needs [uv](https://docs.astral.sh/uv/)):
43
+
44
+ ```text
45
+ /plugin marketplace add LL333111/voxprep
46
+ /plugin install voxprep@voxprep
47
+ ```
48
+
49
+ **Claude Desktop, Cursor, Windsurf and any other MCP client**: add this to the MCP config.
50
+
51
+ ```json
52
+ {
53
+ "mcpServers": {
54
+ "voxprep": { "command": "uvx", "args": ["--from", "voxprep[mcp]", "voxprep", "mcp"] }
55
+ }
56
+ }
57
+ ```
58
+
59
+ **Codex, Gemini CLI and anything that reads a rules file**:
60
+
61
+ ```bash
62
+ pip install voxprep
63
+ voxprep install-skill # Claude Code: adds the skill to ~/.claude/skills/
64
+ voxprep install-skill --print # everything else: paste the output into AGENTS.md
65
+ ```
66
+
67
+ Every command takes `--json`. Setup details and first-run notes are in
68
+ [docs/agents.md](docs/agents.md).
69
+
70
+ ## Answers that point to the second
71
+
72
+ Hand Claude a transcript and each citation in its answer maps back to a time in the recording.
73
+ On our tests it landed on the right sentence 100% of the time in English and 90% in Chinese.
74
+
75
+ ```python
76
+ import anthropic
77
+
78
+ msg = anthropic.Anthropic().messages.create(
79
+ model="claude-opus-5-5",
80
+ max_tokens=2000,
81
+ messages=[{"role": "user", "content": [
82
+ t.to_claude(title="Weekly meeting"), # document block with citations on
83
+ {"type": "text", "text": "What did we decide about the launch date?"},
84
+ ]}],
85
+ )
86
+ for block in msg.content:
87
+ if block.type == "text":
88
+ print(block.text)
89
+ for c in block.citations or []:
90
+ start, end = t.locate(c) # seconds in the recording
91
+ print(f" at {start:.0f}s")
92
+ ```
93
+
94
+
95
+ For any other chat model:
96
+
97
+ ```python
98
+ t = vp.transcribe("meeting.mp4")
99
+ t.to_markdown() # "[00:12:41] text" lines
100
+ t.estimate_tokens() # will it fit in the context window?
101
+ ```
102
+
103
+ ## What it does for you
104
+
105
+ - **Reads any file.** MP4, MKV, MOV, M4A, MP3, Opus, FLAC, WAV, 5.1 audio, broken downloads:
106
+ anything FFmpeg can read, with no FFmpeg to install.
107
+ - **Cuts only where nobody is talking.** A file over a model's limit is split in a pause found
108
+ by the Silero voice-activity model (in non-stop speech, at the quietest moment).
109
+ - **Keeps one timeline.** Every piece goes back on the source timeline. Split files score
110
+ within a point of files sent whole.
111
+ - **Fixes what speech models get wrong.** Skipped speech is sent again on its own, invented
112
+ text over silence and music is dropped, and whatever is still missing is listed in
113
+ `possible_gaps` instead of being papered over.
114
+ - **Writes what you need.** SRT, VTT, timestamped Markdown, plain text, JSON, or a Claude
115
+ document with citations.
116
+ - **Stays light.** numpy, PyAV and onnxruntime. About 200 MB installed, on Windows, macOS and
117
+ Linux, Python 3.11+.
118
+
119
+ ## Choosing a speech model
120
+
121
+ `voxprep subtitle talk.mp4` picks one for you:
122
+
123
+ | You have | voxprep uses | Good to know |
124
+ | --- | --- | --- |
125
+ | Nothing | NVIDIA Parakeet, on your CPU | 6.6% word errors on a 20-minute talk, about 5x real time on a laptop. Downloaded once (660 MB). Free and offline |
126
+ | `GROQ_API_KEY` ([free](https://console.groq.com/keys)) | Groq Whisper | The fastest: about a minute per hour of audio. 5.8% on the same talk |
127
+ | `OPENAI_API_KEY` | OpenAI gpt-transcribe | For the tightest subtitle timing add `--model whisper-1` |
128
+
129
+ ```bash
130
+ pip install "voxprep[groq]" # adds the client for Groq and OpenAI
131
+ ```
132
+
133
+ - `--via groq|openai|local` picks one yourself. With a key set, the audio is sent to that
134
+ service; `--via local` (or `VOXPREP_VIA=local`) keeps every recording on your computer.
135
+ - The local model is English. For Mandarin, Cantonese, Japanese or Korean add `--language zh`
136
+ (or `yue`, `ja`, `ko`) and voxprep uses SenseVoice instead (240 MB). For other languages use
137
+ Groq or OpenAI; voxprep notices within the first minute and tells you.
138
+ - voxprep says so when another model would do better. `VOXPREP_QUIET=1` turns the tips off.
139
+
140
+ ## Bring your own model
141
+
142
+ voxprep prepares the audio, you call any model you like, and voxprep puts the answers back
143
+ together:
144
+
145
+ ```python
146
+ import voxprep as vp
147
+
148
+ result = vp.prepare("call.m4a", target="openai") # or max_mb=..., max_seconds=..., fmt=...
149
+ texts = [my_model(chunk.to_bytes()) for chunk in result.chunks]
150
+ vp.stitch(result, texts).refine().to_srt("call.srt")
151
+ ```
152
+
153
+ `stitch` reads whatever comes back: OpenAI-style JSON with segments, SRT, VTT, or plain text.
154
+ Plain text without timestamps is spread over the speech voxprep detected in that chunk.
155
+
156
+ Same thing from the command line:
157
+
158
+ ```bash
159
+ voxprep prepare talk.mp4 --for custom --max-mb 10 --max-sec 300 --format wav -o chunks
160
+ # ...send chunks/chunk_000.wav etc. to your model, save answers as chunks/chunk_000.txt...
161
+ voxprep stitch chunks -o talk.srt
162
+ ```
163
+
164
+ More:
165
+
166
+ ```bash
167
+ voxprep inspect talk.mp4 # duration, format, silence, which models take it as is
168
+ voxprep presets # every preset and its limits
169
+ voxprep ref-clip podcast.mp4 --for f5 # cleanest 3-12 s of one voice, for TTS voice cloning
170
+ ```
171
+
172
+ ## Supported models
173
+
174
+ | Preset | Model | Limit voxprep keeps to |
175
+ | --- | --- | --- |
176
+ | `openai` | OpenAI transcription (gpt-transcribe, whisper-1, gpt-4o-*-transcribe) | 24 MB |
177
+ | `groq` | Groq Whisper | 24 MB; avoids chunks under 10 s (billed as 10 s) |
178
+ | `gemini` | Gemini audio, inline | 14 MB; 5-minute pieces for accurate timestamps |
179
+ | `parakeet` | NVIDIA Parakeet TDT (the built-in English model) | 20 s |
180
+ | `sensevoice` | SenseVoice / FunASR | 28 s |
181
+ | `qwen3-asr-flash` | Qwen3-ASR-Flash | 9.5 MB, 290 s |
182
+
183
+
184
+ Anything else: `--for custom` with your own `--max-mb`, `--max-sec`, `--rate` and `--format`.
185
+ `ref-clip` has presets for `f5`, `cosyvoice`, `qwen3-tts` and `generic`.
186
+
187
+ ## Tested on real audio
188
+
189
+ Before this release, more than 70 recordings went through the whole pipeline with Groq, OpenAI,
190
+ Gemini and the built-in local models: podcasts, meetings, phone-quality calls, music and café
191
+ noise under speech, clipped and very quiet audio, and files up to 3 hours, in English, Mandarin
192
+ and Cantonese.
193
+
194
+ The unit tests and a correctness benchmark (every chunk under its limit, every cut in a pause,
195
+ stitched times within 1 ms) run in CI on Windows, macOS and Linux, and CI downloads the local
196
+ models and transcribes with them on all three:
197
+
198
+ ```bash
199
+ uv run pytest
200
+ uv run python benchmarks/bench_correctness.py
201
+ ```
202
+
203
+ ## Compared with
204
+
205
+ - **A script with pydub and a loop**: needs system FFmpeg, and you still look up each API's
206
+ limits, fix the timestamps and find the sentences the model dropped.
207
+ - **faster-whisper / WhisperX**: they run Whisper on your own machine, best with a GPU. voxprep
208
+ is the layer around any model: hosted APIs, your own, or its built-in CPU model, with the
209
+ same fixes and the same output formats for all of them.
210
+ - **silero-vad**: the same voice-activity model, but voxprep runs it on onnxruntime, so there
211
+ is no PyTorch to install.
212
+
213
+ ## Not yet
214
+
215
+ - Speaker labels (who said what).
216
+ - A local model for languages other than English, Mandarin, Cantonese, Japanese and Korean.
217
+ - Reading straight from a URL: download the file first.
218
+
219
+ Missing something? [Open an issue](https://github.com/LL333111/voxprep/issues) or see
220
+ [CONTRIBUTING.md](CONTRIBUTING.md); a new model is usually one small preset.
221
+
222
+ ## License
223
+
224
+ MIT. Ships Silero VAD v6 (MIT). PyAV wheels include FFmpeg libraries (LGPL).
225
+
226
+ The built-in local models are not part of the package and are not MIT. voxprep downloads
227
+ them on first use, as converted to ONNX by [sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx):
228
+
229
+ - English: [Parakeet-TDT-0.6B-v2](https://huggingface.co/nvidia/parakeet-tdt-0.6b-v2) by NVIDIA,
230
+ [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), quantised to int8. NVIDIA does not
231
+ endorse voxprep.
232
+ - Mandarin, Cantonese, Japanese, Korean: [SenseVoiceSmall](https://huggingface.co/FunAudioLLM/SenseVoiceSmall)
233
+ by FunAudioLLM / Alibaba Group, under the
234
+ [FunASR Model Open Source License Agreement](https://github.com/modelscope/FunASR/blob/main/MODEL_LICENSE).