Skip to main content
Glama
README.md
# voxprep

<!-- mcp-name: io.github.LL333111/voxprep -->

**Let your AI hear.** Subtitles and timestamped transcripts from any audio or video, and
answers that cite the exact second. No API key, no PyTorch, no FFmpeg install.

[![PyPI](https://img.shields.io/pypi/v/voxprep)](https://pypi.org/project/voxprep/)
[![Python](https://img.shields.io/pypi/pyversions/voxprep)](https://pypi.org/project/voxprep/)
[![CI](https://github.com/LL333111/voxprep/actions/workflows/ci.yml/badge.svg)](https://github.com/LL333111/voxprep/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue)](LICENSE)

[中文](README_ZH.md)

```bash
pip install voxprep
voxprep subtitle talk.mp4            # writes talk.srt
voxprep transcribe talk.mp4 -f md    # writes talk.transcript.md, for your AI to read
```

That's it. The speech model runs on your CPU; nothing is uploaded and there is nothing to
sign up for.

![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)

A 35-minute NASA podcast becomes a transcript; Claude answers from it, and every sentence of
the answer comes with the moment it was said. Real output; the script is
[examples/ask.py](examples/ask.py).

Measured on more than 70 real recordings before release:

- **Half the errors on recordings with long pauses** (9.8% → 4.3% word error rate): speech
  Whisper skips is sent again, and the "Thank you." it invents over silence is dropped.
- **Subtitles start 0.07 s from the truth** (median), however many pieces the file was cut into.
- **A 3-hour file is ready to send in 3 minutes** on about 1 GB of memory.

## Give it to your AI assistant

Claude, Cursor and other assistants can't listen to a file. With voxprep they can: set it up
once, then ask "what did they decide in meeting.mp4?"

**Claude Code** (needs [uv](https://docs.astral.sh/uv/)):

```text
/plugin marketplace add LL333111/voxprep
/plugin install voxprep@voxprep
```

**Claude Desktop, Cursor, Windsurf and any other MCP client**: add this to the MCP config.

```json
{
  "mcpServers": {
    "voxprep": { "command": "uvx", "args": ["--from", "voxprep[mcp]", "voxprep", "mcp"] }
  }
}
```

**Codex, Gemini CLI and anything that reads a rules file**:

```bash
pip install voxprep
voxprep install-skill           # Claude Code: adds the skill to ~/.claude/skills/
voxprep install-skill --print   # everything else: paste the output into AGENTS.md
```

Every command takes `--json`. Setup details and first-run notes are in
[docs/agents.md](docs/agents.md).

## Answers that point to the second

Hand Claude a transcript and each citation in its answer maps back to a time in the recording.
On our tests it landed on the right sentence 100% of the time in English and 90% in Chinese.

```python
import anthropic

msg = anthropic.Anthropic().messages.create(
    model="claude-opus-5-5",
    max_tokens=2000,
    messages=[{"role": "user", "content": [
        t.to_claude(title="Weekly meeting"),   # document block with citations on
        {"type": "text", "text": "What did we decide about the launch date?"},
    ]}],
)
for block in msg.content:
    if block.type == "text":
        print(block.text)
        for c in block.citations or []:
            start, end = t.locate(c)            # seconds in the recording
            print(f"  at {start:.0f}s")
```


For any other chat model:

```python
t = vp.transcribe("meeting.mp4")
t.to_markdown()        # "[00:12:41] text" lines
t.estimate_tokens()    # will it fit in the context window?
```

## What it does for you

- **Reads any file.** MP4, MKV, MOV, M4A, MP3, Opus, FLAC, WAV, 5.1 audio, broken downloads:
  anything FFmpeg can read, with no FFmpeg to install.
- **Cuts only where nobody is talking.** A file over a model's limit is split in a pause found
  by the Silero voice-activity model (in non-stop speech, at the quietest moment).
- **Keeps one timeline.** Every piece goes back on the source timeline. Split files score
  within a point of files sent whole.
- **Fixes what speech models get wrong.** Skipped speech is sent again on its own, invented
  text over silence and music is dropped, and whatever is still missing is listed in
  `possible_gaps` instead of being papered over.
- **Writes what you need.** SRT, VTT, timestamped Markdown, plain text, JSON, or a Claude
  document with citations.
- **Stays light.** numpy, PyAV and onnxruntime. About 200 MB installed, on Windows, macOS and
  Linux, Python 3.11+.

## Choosing a speech model

`voxprep subtitle talk.mp4` picks one for you:

| You have | voxprep uses | Good to know |
| --- | --- | --- |
| 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 |
| `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 |
| `OPENAI_API_KEY` | OpenAI gpt-transcribe | For the tightest subtitle timing add `--model whisper-1` |

```bash
pip install "voxprep[groq]"     # adds the client for Groq and OpenAI
```

- `--via groq|openai|local` picks one yourself. With a key set, the audio is sent to that
  service; `--via local` (or `VOXPREP_VIA=local`) keeps every recording on your computer.
- The local model is English. For Mandarin, Cantonese, Japanese or Korean add `--language zh`
  (or `yue`, `ja`, `ko`) and voxprep uses SenseVoice instead (240 MB). For other languages use
  Groq or OpenAI; voxprep notices within the first minute and tells you.
- voxprep says so when another model would do better. `VOXPREP_QUIET=1` turns the tips off.

## Bring your own model

voxprep prepares the audio, you call any model you like, and voxprep puts the answers back
together:

```python
import voxprep as vp

result = vp.prepare("call.m4a", target="openai")   # or max_mb=..., max_seconds=..., fmt=...
texts = [my_model(chunk.to_bytes()) for chunk in result.chunks]
vp.stitch(result, texts).refine().to_srt("call.srt")
```

`stitch` reads whatever comes back: OpenAI-style JSON with segments, SRT, VTT, or plain text.
Plain text without timestamps is spread over the speech voxprep detected in that chunk.

Same thing from the command line:

```bash
voxprep prepare talk.mp4 --for custom --max-mb 10 --max-sec 300 --format wav -o chunks
# ...send chunks/chunk_000.wav etc. to your model, save answers as chunks/chunk_000.txt...
voxprep stitch chunks -o talk.srt
```

More:

```bash
voxprep inspect talk.mp4                 # duration, format, silence, which models take it as is
voxprep presets                          # every preset and its limits
voxprep ref-clip podcast.mp4 --for f5    # cleanest 3-12 s of one voice, for TTS voice cloning
```

## Supported models

| Preset | Model | Limit voxprep keeps to |
| --- | --- | --- |
| `openai` | OpenAI transcription (gpt-transcribe, whisper-1, gpt-4o-*-transcribe) | 24 MB |
| `groq` | Groq Whisper | 24 MB; avoids chunks under 10 s (billed as 10 s) |
| `gemini` | Gemini audio, inline | 14 MB; 5-minute pieces for accurate timestamps |
| `parakeet` | NVIDIA Parakeet TDT (the built-in English model) | 20 s |
| `sensevoice` | SenseVoice / FunASR | 28 s |
| `qwen3-asr-flash` | Qwen3-ASR-Flash | 9.5 MB, 290 s |


Anything else: `--for custom` with your own `--max-mb`, `--max-sec`, `--rate` and `--format`.
`ref-clip` has presets for `f5`, `cosyvoice`, `qwen3-tts` and `generic`.

## Tested on real audio

Before this release, more than 70 recordings went through the whole pipeline with Groq, OpenAI,
Gemini and the built-in local models: podcasts, meetings, phone-quality calls, music and café
noise under speech, clipped and very quiet audio, and files up to 3 hours, in English, Mandarin
and Cantonese.

The unit tests and a correctness benchmark (every chunk under its limit, every cut in a pause,
stitched times within 1 ms) run in CI on Windows, macOS and Linux, and CI downloads the local
models and transcribes with them on all three:

```bash
uv run pytest
uv run python benchmarks/bench_correctness.py
```

## Compared with

- **A script with pydub and a loop**: needs system FFmpeg, and you still look up each API's
  limits, fix the timestamps and find the sentences the model dropped.
- **faster-whisper / WhisperX**: they run Whisper on your own machine, best with a GPU. voxprep
  is the layer around any model: hosted APIs, your own, or its built-in CPU model, with the
  same fixes and the same output formats for all of them.
- **silero-vad**: the same voice-activity model, but voxprep runs it on onnxruntime, so there
  is no PyTorch to install.

## Not yet

- Speaker labels (who said what).
- A local model for languages other than English, Mandarin, Cantonese, Japanese and Korean.
- Reading straight from a URL: download the file first.

Missing something? [Open an issue](https://github.com/LL333111/voxprep/issues) or see
[CONTRIBUTING.md](CONTRIBUTING.md); a new model is usually one small preset.

## License

MIT. Ships Silero VAD v6 (MIT). PyAV wheels include FFmpeg libraries (LGPL).

The built-in local models are not part of the package and are not MIT. voxprep downloads
them on first use, as converted to ONNX by [sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx):

- English: [Parakeet-TDT-0.6B-v2](https://huggingface.co/nvidia/parakeet-tdt-0.6b-v2) by NVIDIA,
  [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), quantised to int8. NVIDIA does not
  endorse voxprep.
- Mandarin, Cantonese, Japanese, Korean: [SenseVoiceSmall](https://huggingface.co/FunAudioLLM/SenseVoiceSmall)
  by FunAudioLLM / Alibaba Group, under the
  [FunASR Model Open Source License Agreement](https://github.com/modelscope/FunASR/blob/main/MODEL_LICENSE).