babelscribe 0.3.2__tar.gz → 0.5.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 (46) hide show
  1. {babelscribe-0.3.2 → babelscribe-0.5.0}/LICENSE +21 -21
  2. {babelscribe-0.3.2 → babelscribe-0.5.0}/PKG-INFO +115 -7
  3. {babelscribe-0.3.2 → babelscribe-0.5.0}/README.md +114 -6
  4. {babelscribe-0.3.2 → babelscribe-0.5.0}/babelscribe/__init__.py +2 -2
  5. {babelscribe-0.3.2 → babelscribe-0.5.0}/babelscribe/__main__.py +3 -3
  6. babelscribe-0.5.0/babelscribe/api.py +241 -0
  7. babelscribe-0.5.0/babelscribe/backend.py +232 -0
  8. babelscribe-0.5.0/babelscribe/burn.py +476 -0
  9. babelscribe-0.5.0/babelscribe/cli.py +229 -0
  10. babelscribe-0.5.0/babelscribe/convert.py +135 -0
  11. babelscribe-0.5.0/babelscribe/doctor.py +150 -0
  12. {babelscribe-0.3.2 → babelscribe-0.5.0}/babelscribe/hybrid.py +13 -8
  13. babelscribe-0.5.0/babelscribe/llm_translate.py +323 -0
  14. babelscribe-0.5.0/babelscribe/mcp_server.py +342 -0
  15. {babelscribe-0.3.2 → babelscribe-0.5.0}/babelscribe/models.py +103 -94
  16. {babelscribe-0.3.2 → babelscribe-0.5.0}/babelscribe/transcribe.py +136 -70
  17. babelscribe-0.5.0/babelscribe/writers.py +318 -0
  18. {babelscribe-0.3.2 → babelscribe-0.5.0}/babelscribe.egg-info/PKG-INFO +115 -7
  19. {babelscribe-0.3.2 → babelscribe-0.5.0}/babelscribe.egg-info/SOURCES.txt +18 -1
  20. {babelscribe-0.3.2 → babelscribe-0.5.0}/pyproject.toml +48 -48
  21. babelscribe-0.5.0/tests/test_api_stability.py +67 -0
  22. babelscribe-0.5.0/tests/test_aur_pkgbuild.py +95 -0
  23. babelscribe-0.5.0/tests/test_binary_verify.py +107 -0
  24. babelscribe-0.5.0/tests/test_burn.py +262 -0
  25. babelscribe-0.5.0/tests/test_convert.py +194 -0
  26. babelscribe-0.5.0/tests/test_core.py +827 -0
  27. babelscribe-0.5.0/tests/test_doctor.py +46 -0
  28. babelscribe-0.5.0/tests/test_homebrew_formula.py +58 -0
  29. babelscribe-0.5.0/tests/test_llm_translate.py +244 -0
  30. babelscribe-0.5.0/tests/test_plugin_marketplace.py +83 -0
  31. babelscribe-0.5.0/tests/test_progress.py +155 -0
  32. babelscribe-0.5.0/tests/test_release_tool.py +118 -0
  33. babelscribe-0.5.0/tests/test_standalone_packaging.py +36 -0
  34. babelscribe-0.5.0/tests/test_windows_packaging.py +90 -0
  35. babelscribe-0.3.2/babelscribe/api.py +0 -59
  36. babelscribe-0.3.2/babelscribe/backend.py +0 -118
  37. babelscribe-0.3.2/babelscribe/cli.py +0 -56
  38. babelscribe-0.3.2/babelscribe/mcp_server.py +0 -139
  39. babelscribe-0.3.2/babelscribe/writers.py +0 -29
  40. babelscribe-0.3.2/tests/test_core.py +0 -60
  41. {babelscribe-0.3.2 → babelscribe-0.5.0}/babelscribe/align.py +0 -0
  42. {babelscribe-0.3.2 → babelscribe-0.5.0}/babelscribe.egg-info/dependency_links.txt +0 -0
  43. {babelscribe-0.3.2 → babelscribe-0.5.0}/babelscribe.egg-info/entry_points.txt +0 -0
  44. {babelscribe-0.3.2 → babelscribe-0.5.0}/babelscribe.egg-info/requires.txt +0 -0
  45. {babelscribe-0.3.2 → babelscribe-0.5.0}/babelscribe.egg-info/top_level.txt +0 -0
  46. {babelscribe-0.3.2 → babelscribe-0.5.0}/setup.cfg +0 -0
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 babelscribe contributors
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.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 babelscribe contributors
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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: babelscribe
3
- Version: 0.3.2
3
+ Version: 0.5.0
4
4
  Summary: Transcribe any audio/video in 99 languages on any GPU (AMD, NVIDIA, Intel via Vulkan; NVIDIA via CUDA; Apple via Metal) or CPU — whisper.cpp with batteries included.
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://github.com/phonology024/babelscribe
@@ -48,6 +48,7 @@ Dynamic: license-file
48
48
  [![PyPI](https://img.shields.io/pypi/v/babelscribe)](https://pypi.org/project/babelscribe/)
49
49
  [![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)
50
50
  [![MCP server](https://img.shields.io/badge/MCP-server-blue)](#use-it-from-an-ai-app-mcp--no-terminal-needed)
51
+ **Translations:** [తెలుగు (Telugu)](README.te.md)
51
52
 
52
53
  **babelscribe turns any audio or video file into subtitles (SRT, VTT) and text, in any of Whisper's 99 languages, on your
53
54
  own graphics card — AMD Radeon, NVIDIA, Intel Arc or Apple Silicon — or the CPU. No CUDA needed, no cloud, free (MIT).**
@@ -80,8 +81,14 @@ transcribe files on **your** computer with **your** GPU. Ask in plain words —
80
81
  my Downloads"* — and the app finds the file, transcribes it, writes `.srt` / `.txt` next to it, and can then proofread names,
81
82
  translate or summarise the text for you.
82
83
 
83
- Tools: `transcribe` (file → subtitles + text), `find_media` (newest audio/video in Downloads, Videos, Desktop, …),
84
- `list_devices`, `list_languages_and_models`.
84
+ Tools: `transcribe` (file → subtitles + text), `transcribe_folder` (every audio/video in a folder, one summary
85
+ back), `convert_subtitles` (re-wrap or re-export from the saved JSON, no transcription), `burn_subtitles` (the video with
86
+ the subtitles drawn on it), `translate_subtitles` (into any language, through an LLM on your computer), `find_media` (newest audio/video in Downloads, Videos, Desktop, …), `list_devices`,
87
+ `list_languages_and_models`.
88
+
89
+ `transcribe_folder` goes on after a file fails and lists the failure in the summary. Subtitles land next to each
90
+ file, or under `output_dir` with the same sub-folders. Two files that would share a subtitle name (`talk.mp4` and
91
+ `talk.mp3`) keep their full name: `talk.mp4.srt`, `talk.mp3.srt`.
85
92
 
86
93
  **Claude Desktop (one click):** download `babelscribe.mcpb` from the [latest release](https://github.com/phonology024/babelscribe/releases/latest)
87
94
  and double-click it (or *Settings → Extensions → Install extension*).
@@ -108,6 +115,9 @@ and double-click it (or *Settings → Extensions → Install extension*).
108
115
  (`timeout` is in milliseconds and only some apps read it.) Already installed with pip? Use `"command": "babelscribe", "args": ["mcp"]`.
109
116
  Web-only chat apps (e.g. grok.com, chatgpt.com) can only reach servers on the internet, not your computer, so they can't use your GPU or files.
110
117
 
118
+ The MCP tools use the `turbo` model (1.6 GB). On a small machine set `BABELSCRIBE_MODEL` in the server's
119
+ environment to pick another one, e.g. `"env": {"BABELSCRIBE_MODEL": "small"}` in the JSON above.
120
+
111
121
  ## Benchmark: real talks, human captions as the answer key
112
122
  Four TED / TEDx talks, scored against the **human-made captions in the spoken language** (`bench/bench.py`, reproducible).
113
123
  Error = word error rate (WER) for space-separated languages, character error rate (CER) for Japanese and Thai.
@@ -216,34 +226,128 @@ languages are the most valuable contribution.
216
226
  - **Long files that don't loop** — runs whisper with `--max-context 0`, which stops the classic "same sentence repeated forever" hallucination on long recordings.
217
227
  - **Hybrid mode for better spelling in your language** — community fine-tunes (e.g. Thai *Thonburian Whisper*) spell far better but often lose timestamps. `--text-model` takes the text from the fine-tune and the timing from `large-v3-turbo`, aligned character by character (works for languages without spaces), cut only at word boundaries, with the timing model filling any words the fine-tune skipped.
218
228
  - **`--accurate`** — slower, fewest errors: large-v3 with beam search, or for Thai and Hindi the best community fine-tune (hybrid). Chosen per language from the FLEURS benchmark above.
219
- - **Outputs** — `srt`, `vtt`, `txt`, `json` (segments with token timings).
229
+ - **Custom vocabulary** — `--prompt "Pitakpong, babelscribe"` gives whisper an initial prompt that biases the spelling of names and jargon. In the MCP `transcribe` tool the same thing is the `vocabulary` argument. While a prompt is set, `--max-context 0` is not passed (whisper.cpp ignores the prompt otherwise).
230
+ - **Translate to English** — `--translate` writes the transcript translated to English (whisper's translate task, any source language). It uses `large-v3` because turbo was not trained to translate, and cannot be combined with `--text-model`. In the MCP `transcribe` tool it is the `translate` argument.
231
+ - **Progress** — in a terminal the CLI draws a progress bar per file (`--no-progress` turns it off; it is never drawn into a pipe or a log). MCP clients get a notification every 5 seconds with the real percentage (`progress` of `total` 100 for one file; files done plus the fraction of the current one for a folder). From Python: `transcribe_file(..., progress=callback)`, called with 0 to 100.
232
+ - **Outputs** — `srt`, `vtt`, `txt`, `json` (segments with token timings), `ass` (karaoke: each word highlights
233
+ as it is spoken, from the token timings — for short-form video and players that read ASS).
220
234
 
221
235
  ## Usage
222
236
  ```bash
223
237
  babelscribe talk.mp4 -f srt,vtt,txt,json # all formats
238
+ babelscribe a.mp4 b.mp3 c.wav # several files in one run
239
+ babelscribe ./recordings # every audio/video file in a folder (-r: sub-folders too)
240
+ babelscribe ./recordings -o ./subs --skip-existing # write into a folder; leave files that are already done
241
+ babelscribe reel.mp4 -f ass # karaoke subtitles, one highlight per word
224
242
  babelscribe podcast.mp3 -l en -m large-v3 # pick language and model
225
243
  babelscribe talk.mp4 -l hi --accurate # slower, fewest errors (best model per language)
226
244
  babelscribe vo.wav -l th --text-model thai-thonburian # hybrid: pick a Thai fine-tune yourself
245
+ babelscribe talk.mp4 --prompt "Pitakpong, babelscribe" # bias the spelling of names and terms
246
+ babelscribe talk.mp4 --translate # subtitles translated to English
247
+ babelscribe talk.mp4 --translate-to th # also talk.th.srt: any language, through your local LLM
248
+ babelscribe convert talk.json -f srt,ass --max-line-chars 20 # re-wrap / re-export, no transcription
249
+ babelscribe clip.mp4 --burn --style shorts # also clip.subbed.mp4: the video with the captions drawn on
227
250
  babelscribe devices # GPUs whisper.cpp can see
228
251
  babelscribe models # models and fine-tunes
229
252
  babelscribe talk.mp4 --bin /path/to/whisper-cli # use your own whisper.cpp build
230
253
  ```
254
+ With several files or a folder, a file that fails does not stop the rest: the run ends with a summary line
255
+ (`12 done, 0 skipped, 1 failed`) and a non-zero exit code if anything failed. `-o` is then an output folder, and
256
+ two files that would share a subtitle name (`talk.mp4` and `talk.mp3`) keep their full name.
257
+
258
+ **Fix and re-export.** Transcribing is the slow part; how the subtitles look is the part you redo. Keep the JSON
259
+ and the rest takes no time:
260
+ ```bash
261
+ babelscribe talk.mp4 -f json,srt # once
262
+ # correct names or words in the "text" fields of talk.json, then:
263
+ babelscribe convert talk.json -f srt,vtt,ass # every format gets the corrected text, with its timing
264
+ ```
265
+ `convert` also takes `--max-line-chars`, `--max-lines 1`, and three reading-speed rules that are off unless asked
266
+ for: `--max-duration 7` (cut subtitles that stay up longer), `--min-duration 1` and `--max-cps 17` (keep short or
267
+ fast subtitles up longer, never into the next one). In MCP it is the `convert_subtitles` tool, which is why the
268
+ MCP tools now write a `.json` by default.
269
+
270
+ **Translate into any language, with your own LLM.** `--translate` is whisper's own translator and only writes
271
+ English. For any other direction (English to Thai, Japanese to Spanish, ...) babelscribe can hand the finished
272
+ subtitles to an LLM running on your computer: Ollama, LM Studio, llama-server, or anything else with an
273
+ OpenAI-compatible API. babelscribe downloads no model for this; it uses the one you already run.
274
+ ```bash
275
+ babelscribe talk.mp4 --translate-to th # talk.srt as usual, plus talk.th.srt
276
+ babelscribe translate talk.json --to ja -f srt,vtt # later, from the saved JSON (or from any .srt / .vtt)
277
+ babelscribe talk.mp4 --translate-to es --llm http://127.0.0.1:11434/v1 --llm-model gemma3
278
+ ```
279
+ Only the text is translated: every sentence keeps its own start and end time, and the lines are wrapped again by
280
+ the rules of the target language (shorter lines for Thai, Japanese and Chinese). The original files are not
281
+ changed. Without `--llm`, the usual local ports are tried (llama-server 8080, Ollama 11434, LM Studio 1234), or
282
+ set `BABELSCRIBE_LLM`. If nothing answers, babelscribe says so before it starts transcribing. The endpoint must
283
+ be on this computer; `--allow-remote` is the explicit switch for sending the text to another machine.
284
+
285
+ Measured: a 3 min 18 s English recording into Thai with Gemma (26B, Q4) in llama-server on a Radeon RX 9070 XT:
286
+ 17 s to transcribe, 38 s to translate. Translation quality is the model's: a small model translates fast and
287
+ loosely, so read the result before you publish it. In MCP it is `translate_to` on `transcribe`, and the
288
+ `translate_subtitles` tool.
289
+
290
+ **Burn the subtitles into the video.** For TikTok, Reels and Shorts the result you post is the video with the
291
+ captions on it, not an `.srt`:
292
+ ```bash
293
+ babelscribe clip.mp4 --burn # clip.subbed.mp4, white subtitles at the bottom
294
+ babelscribe clip.mp4 --burn --style karaoke # each word lights up as it is spoken
295
+ babelscribe clip.mp4 --burn --style shorts # big, two or three words at a time, placed for vertical video
296
+ babelscribe burn clip.mp4 # again from the saved clip.json (after fixing words, or another style)
297
+ babelscribe burn clip.mp4 clip.ass # an .ass you styled yourself is drawn exactly as it is
298
+ ```
299
+ | `babelscribe jfk.mp4 --burn --style karaoke` | `babelscribe clip.mp4 -l th --burn --style shorts` |
300
+ |---|---|
301
+ | ![English clip with karaoke subtitles](https://raw.githubusercontent.com/phonology024/babelscribe/main/docs/img/burn-karaoke-en.jpg) | ![Vertical Thai clip with shorts captions](https://raw.githubusercontent.com/phonology024/babelscribe/main/docs/img/burn-shorts-th.jpg) |
302
+
303
+ Frames from real runs (speech: JFK's 1961 inaugural address, public domain; a Thai sentence from Google FLEURS, CC BY 4.0).
304
+
305
+ The input video is never changed and its audio is copied as it is. Text size and position follow the picture
306
+ (a phone video counts as vertical), and the font is one that has the letters of the language: Thai, Japanese,
307
+ Chinese, Korean, Arabic and Devanagari are looked up among the fonts on your computer, and if none has them
308
+ babelscribe says which to install instead of drawing empty boxes (`--font "Name"` to choose yourself). The video is
309
+ encoded on the GPU when it can be (NVIDIA, AMD, Intel, Apple), otherwise with x264. An `.srt` or `.vtt` can be
310
+ burned too, plain only, since it has no word timings. For Thai in the shorts look, `pip install "babelscribe[thai]"`
311
+ keeps words whole. In MCP it is the `burn_subtitles` tool.
312
+
231
313
  From Python:
232
314
  ```python
233
315
  from babelscribe.api import transcribe_file
234
- r = transcribe_file("talk.mp4", lang="auto", formats=["srt", "txt"]) # or accurate=True
316
+ r = transcribe_file("talk.mp4", lang="auto", formats=["srt", "txt"]) # or accurate=True, prompt="names, terms"
235
317
  print(r["lang"], r["device"], r["files"]); print(r["text"][:200])
318
+
319
+ from babelscribe.api import transcribe_many
320
+ done = transcribe_many(["a.mp4", "./recordings"], recursive=True, formats=["srt"]) # other options as above
321
+ print(done["succeeded"], done["failed"])
236
322
  ```
237
323
  Models download on first use to `~/.babelscribe/models` (`BABELSCRIBE_MODELS` to change). Hybrid fine-tunes are converted on your
238
324
  machine from their original Hugging Face repo — install `pip install "babelscribe[finetune]"` once; converted weights are never
239
325
  redistributed, so each fine-tune keeps its own licence. Thai word boundaries: `pip install "babelscribe[thai]"`.
240
326
 
327
+ ## Docker
328
+ No Python, ffmpeg or whisper.cpp on the host — the image has them, and the model is cached in a volume. There is no
329
+ published image yet, so build it from a checkout, then run it on the folder that holds your media:
330
+ ```bash
331
+ docker build -t babelscribe -f docker/Dockerfile .
332
+ docker run --rm -v "$PWD:/media" -v babelscribe-models:/models babelscribe talk.mp4 # writes talk.srt next to the input
333
+ ```
334
+ CPU by default, linux/amd64; a Vulkan image for GPU hosts is one `--build-arg` away. Details: [docker/README.md](docker/README.md).
335
+
336
+ ## Roadmap
337
+ What's planned next (real progress percentages, folders on the command line, verified downloads, more fine-tunes, burn-in subtitles, a desktop app) is in [ROADMAP.md](ROADMAP.md) and the [open issues](https://github.com/phonology024/babelscribe/issues).
338
+
241
339
  ## Add a language fine-tune
242
340
  Add one entry to `FINETUNES` in `babelscribe/models.py` (Hugging Face repo, language code, whether it needs beam search) and open a PR.
243
341
 
244
342
  ## Prebuilt binaries
245
343
  `.github/workflows/build-binaries.yml` builds `whisper-cli` + `whisper-quantize` for every row of the table above and attaches
246
- them to each `v*` release. Point `BABELSCRIBE_RELEASES` at another URL to self-host.
344
+ them to each `v*` release, with a `SHA256SUMS` file.
345
+
346
+ Each babelscribe version downloads the binaries of one fixed release (`BINARY_TAG` in `babelscribe/backend.py`), not
347
+ "latest", and checks the zip's sha256 before unpacking it. A download that does not match is deleted and nothing is
348
+ run. `babelscribe doctor` shows which release the cached binary came from and whether its files changed since.
349
+ Point `BABELSCRIBE_RELEASES` at another URL to self-host: a mirror of the official zips is checked the same way; a
350
+ mirror with your own builds needs `BABELSCRIBE_SKIP_VERIFY=1`.
247
351
 
248
352
  ## ภาษาไทย
249
353
  ใช้ผ่าน Claude Desktop ได้โดยไม่ต้องพิมพ์คำสั่ง: โหลด `babelscribe.mcpb` จากหน้า Releases แล้วดับเบิลคลิก จากนั้นพิมพ์ในแชทว่า *"ทำซับไทยให้คลิปล่าสุดในโฟลเดอร์ดาวน์โหลด"*
@@ -252,13 +356,17 @@ them to each `v*` release. Point `BABELSCRIBE_RELEASES` at another URL to self-h
252
356
  หรือเลือก Thonburian Whisper เอง: `--text-model thai-thonburian`
253
357
 
254
358
  ## Privacy Policy
255
- babelscribe runs entirely on your own computer. Last updated 2026-10-06.
359
+ babelscribe runs entirely on your own computer. Last updated 2026-11-10.
256
360
 
257
361
  - **Data collection:** none. babelscribe has no telemetry, analytics, accounts or crash reporting, and never uploads your
258
362
  audio, video, transcripts or file names anywhere.
259
363
  - **What it processes and where:** the media file you choose is converted and transcribed locally; subtitles and text are
260
364
  written to your disk (next to the file, or the folder you choose). Through MCP, the transcript text is returned to the AI
261
365
  app that called the tool — what that app does with it is governed by that app's own privacy policy.
366
+ - **Optional translation (`--translate-to`, off unless you ask):** the subtitle text is sent to the LLM endpoint you
367
+ run, which must be on this computer (`127.0.0.1` / `localhost`). It goes to another machine only if you pass
368
+ `--allow-remote` yourself (for the MCP server: `BABELSCRIBE_LLM_ALLOW_REMOTE=1` in its settings; an AI app cannot
369
+ switch it on). Audio and video are never sent.
262
370
  - **Network access (downloads only):** on first use it downloads the `whisper-cli` program from this project's GitHub
263
371
  releases, speech models from Hugging Face (`huggingface.co/ggerganov/whisper.cpp`, and for `--accurate` Thai/Hindi the
264
372
  fine-tune's own repository), and Python packages from PyPI when installed with pip/uv. These are plain downloads;
@@ -5,6 +5,7 @@
5
5
  [![PyPI](https://img.shields.io/pypi/v/babelscribe)](https://pypi.org/project/babelscribe/)
6
6
  [![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)
7
7
  [![MCP server](https://img.shields.io/badge/MCP-server-blue)](#use-it-from-an-ai-app-mcp--no-terminal-needed)
8
+ **Translations:** [తెలుగు (Telugu)](README.te.md)
8
9
 
9
10
  **babelscribe turns any audio or video file into subtitles (SRT, VTT) and text, in any of Whisper's 99 languages, on your
10
11
  own graphics card — AMD Radeon, NVIDIA, Intel Arc or Apple Silicon — or the CPU. No CUDA needed, no cloud, free (MIT).**
@@ -37,8 +38,14 @@ transcribe files on **your** computer with **your** GPU. Ask in plain words —
37
38
  my Downloads"* — and the app finds the file, transcribes it, writes `.srt` / `.txt` next to it, and can then proofread names,
38
39
  translate or summarise the text for you.
39
40
 
40
- Tools: `transcribe` (file → subtitles + text), `find_media` (newest audio/video in Downloads, Videos, Desktop, …),
41
- `list_devices`, `list_languages_and_models`.
41
+ Tools: `transcribe` (file → subtitles + text), `transcribe_folder` (every audio/video in a folder, one summary
42
+ back), `convert_subtitles` (re-wrap or re-export from the saved JSON, no transcription), `burn_subtitles` (the video with
43
+ the subtitles drawn on it), `translate_subtitles` (into any language, through an LLM on your computer), `find_media` (newest audio/video in Downloads, Videos, Desktop, …), `list_devices`,
44
+ `list_languages_and_models`.
45
+
46
+ `transcribe_folder` goes on after a file fails and lists the failure in the summary. Subtitles land next to each
47
+ file, or under `output_dir` with the same sub-folders. Two files that would share a subtitle name (`talk.mp4` and
48
+ `talk.mp3`) keep their full name: `talk.mp4.srt`, `talk.mp3.srt`.
42
49
 
43
50
  **Claude Desktop (one click):** download `babelscribe.mcpb` from the [latest release](https://github.com/phonology024/babelscribe/releases/latest)
44
51
  and double-click it (or *Settings → Extensions → Install extension*).
@@ -65,6 +72,9 @@ and double-click it (or *Settings → Extensions → Install extension*).
65
72
  (`timeout` is in milliseconds and only some apps read it.) Already installed with pip? Use `"command": "babelscribe", "args": ["mcp"]`.
66
73
  Web-only chat apps (e.g. grok.com, chatgpt.com) can only reach servers on the internet, not your computer, so they can't use your GPU or files.
67
74
 
75
+ The MCP tools use the `turbo` model (1.6 GB). On a small machine set `BABELSCRIBE_MODEL` in the server's
76
+ environment to pick another one, e.g. `"env": {"BABELSCRIBE_MODEL": "small"}` in the JSON above.
77
+
68
78
  ## Benchmark: real talks, human captions as the answer key
69
79
  Four TED / TEDx talks, scored against the **human-made captions in the spoken language** (`bench/bench.py`, reproducible).
70
80
  Error = word error rate (WER) for space-separated languages, character error rate (CER) for Japanese and Thai.
@@ -173,34 +183,128 @@ languages are the most valuable contribution.
173
183
  - **Long files that don't loop** — runs whisper with `--max-context 0`, which stops the classic "same sentence repeated forever" hallucination on long recordings.
174
184
  - **Hybrid mode for better spelling in your language** — community fine-tunes (e.g. Thai *Thonburian Whisper*) spell far better but often lose timestamps. `--text-model` takes the text from the fine-tune and the timing from `large-v3-turbo`, aligned character by character (works for languages without spaces), cut only at word boundaries, with the timing model filling any words the fine-tune skipped.
175
185
  - **`--accurate`** — slower, fewest errors: large-v3 with beam search, or for Thai and Hindi the best community fine-tune (hybrid). Chosen per language from the FLEURS benchmark above.
176
- - **Outputs** — `srt`, `vtt`, `txt`, `json` (segments with token timings).
186
+ - **Custom vocabulary** — `--prompt "Pitakpong, babelscribe"` gives whisper an initial prompt that biases the spelling of names and jargon. In the MCP `transcribe` tool the same thing is the `vocabulary` argument. While a prompt is set, `--max-context 0` is not passed (whisper.cpp ignores the prompt otherwise).
187
+ - **Translate to English** — `--translate` writes the transcript translated to English (whisper's translate task, any source language). It uses `large-v3` because turbo was not trained to translate, and cannot be combined with `--text-model`. In the MCP `transcribe` tool it is the `translate` argument.
188
+ - **Progress** — in a terminal the CLI draws a progress bar per file (`--no-progress` turns it off; it is never drawn into a pipe or a log). MCP clients get a notification every 5 seconds with the real percentage (`progress` of `total` 100 for one file; files done plus the fraction of the current one for a folder). From Python: `transcribe_file(..., progress=callback)`, called with 0 to 100.
189
+ - **Outputs** — `srt`, `vtt`, `txt`, `json` (segments with token timings), `ass` (karaoke: each word highlights
190
+ as it is spoken, from the token timings — for short-form video and players that read ASS).
177
191
 
178
192
  ## Usage
179
193
  ```bash
180
194
  babelscribe talk.mp4 -f srt,vtt,txt,json # all formats
195
+ babelscribe a.mp4 b.mp3 c.wav # several files in one run
196
+ babelscribe ./recordings # every audio/video file in a folder (-r: sub-folders too)
197
+ babelscribe ./recordings -o ./subs --skip-existing # write into a folder; leave files that are already done
198
+ babelscribe reel.mp4 -f ass # karaoke subtitles, one highlight per word
181
199
  babelscribe podcast.mp3 -l en -m large-v3 # pick language and model
182
200
  babelscribe talk.mp4 -l hi --accurate # slower, fewest errors (best model per language)
183
201
  babelscribe vo.wav -l th --text-model thai-thonburian # hybrid: pick a Thai fine-tune yourself
202
+ babelscribe talk.mp4 --prompt "Pitakpong, babelscribe" # bias the spelling of names and terms
203
+ babelscribe talk.mp4 --translate # subtitles translated to English
204
+ babelscribe talk.mp4 --translate-to th # also talk.th.srt: any language, through your local LLM
205
+ babelscribe convert talk.json -f srt,ass --max-line-chars 20 # re-wrap / re-export, no transcription
206
+ babelscribe clip.mp4 --burn --style shorts # also clip.subbed.mp4: the video with the captions drawn on
184
207
  babelscribe devices # GPUs whisper.cpp can see
185
208
  babelscribe models # models and fine-tunes
186
209
  babelscribe talk.mp4 --bin /path/to/whisper-cli # use your own whisper.cpp build
187
210
  ```
211
+ With several files or a folder, a file that fails does not stop the rest: the run ends with a summary line
212
+ (`12 done, 0 skipped, 1 failed`) and a non-zero exit code if anything failed. `-o` is then an output folder, and
213
+ two files that would share a subtitle name (`talk.mp4` and `talk.mp3`) keep their full name.
214
+
215
+ **Fix and re-export.** Transcribing is the slow part; how the subtitles look is the part you redo. Keep the JSON
216
+ and the rest takes no time:
217
+ ```bash
218
+ babelscribe talk.mp4 -f json,srt # once
219
+ # correct names or words in the "text" fields of talk.json, then:
220
+ babelscribe convert talk.json -f srt,vtt,ass # every format gets the corrected text, with its timing
221
+ ```
222
+ `convert` also takes `--max-line-chars`, `--max-lines 1`, and three reading-speed rules that are off unless asked
223
+ for: `--max-duration 7` (cut subtitles that stay up longer), `--min-duration 1` and `--max-cps 17` (keep short or
224
+ fast subtitles up longer, never into the next one). In MCP it is the `convert_subtitles` tool, which is why the
225
+ MCP tools now write a `.json` by default.
226
+
227
+ **Translate into any language, with your own LLM.** `--translate` is whisper's own translator and only writes
228
+ English. For any other direction (English to Thai, Japanese to Spanish, ...) babelscribe can hand the finished
229
+ subtitles to an LLM running on your computer: Ollama, LM Studio, llama-server, or anything else with an
230
+ OpenAI-compatible API. babelscribe downloads no model for this; it uses the one you already run.
231
+ ```bash
232
+ babelscribe talk.mp4 --translate-to th # talk.srt as usual, plus talk.th.srt
233
+ babelscribe translate talk.json --to ja -f srt,vtt # later, from the saved JSON (or from any .srt / .vtt)
234
+ babelscribe talk.mp4 --translate-to es --llm http://127.0.0.1:11434/v1 --llm-model gemma3
235
+ ```
236
+ Only the text is translated: every sentence keeps its own start and end time, and the lines are wrapped again by
237
+ the rules of the target language (shorter lines for Thai, Japanese and Chinese). The original files are not
238
+ changed. Without `--llm`, the usual local ports are tried (llama-server 8080, Ollama 11434, LM Studio 1234), or
239
+ set `BABELSCRIBE_LLM`. If nothing answers, babelscribe says so before it starts transcribing. The endpoint must
240
+ be on this computer; `--allow-remote` is the explicit switch for sending the text to another machine.
241
+
242
+ Measured: a 3 min 18 s English recording into Thai with Gemma (26B, Q4) in llama-server on a Radeon RX 9070 XT:
243
+ 17 s to transcribe, 38 s to translate. Translation quality is the model's: a small model translates fast and
244
+ loosely, so read the result before you publish it. In MCP it is `translate_to` on `transcribe`, and the
245
+ `translate_subtitles` tool.
246
+
247
+ **Burn the subtitles into the video.** For TikTok, Reels and Shorts the result you post is the video with the
248
+ captions on it, not an `.srt`:
249
+ ```bash
250
+ babelscribe clip.mp4 --burn # clip.subbed.mp4, white subtitles at the bottom
251
+ babelscribe clip.mp4 --burn --style karaoke # each word lights up as it is spoken
252
+ babelscribe clip.mp4 --burn --style shorts # big, two or three words at a time, placed for vertical video
253
+ babelscribe burn clip.mp4 # again from the saved clip.json (after fixing words, or another style)
254
+ babelscribe burn clip.mp4 clip.ass # an .ass you styled yourself is drawn exactly as it is
255
+ ```
256
+ | `babelscribe jfk.mp4 --burn --style karaoke` | `babelscribe clip.mp4 -l th --burn --style shorts` |
257
+ |---|---|
258
+ | ![English clip with karaoke subtitles](https://raw.githubusercontent.com/phonology024/babelscribe/main/docs/img/burn-karaoke-en.jpg) | ![Vertical Thai clip with shorts captions](https://raw.githubusercontent.com/phonology024/babelscribe/main/docs/img/burn-shorts-th.jpg) |
259
+
260
+ Frames from real runs (speech: JFK's 1961 inaugural address, public domain; a Thai sentence from Google FLEURS, CC BY 4.0).
261
+
262
+ The input video is never changed and its audio is copied as it is. Text size and position follow the picture
263
+ (a phone video counts as vertical), and the font is one that has the letters of the language: Thai, Japanese,
264
+ Chinese, Korean, Arabic and Devanagari are looked up among the fonts on your computer, and if none has them
265
+ babelscribe says which to install instead of drawing empty boxes (`--font "Name"` to choose yourself). The video is
266
+ encoded on the GPU when it can be (NVIDIA, AMD, Intel, Apple), otherwise with x264. An `.srt` or `.vtt` can be
267
+ burned too, plain only, since it has no word timings. For Thai in the shorts look, `pip install "babelscribe[thai]"`
268
+ keeps words whole. In MCP it is the `burn_subtitles` tool.
269
+
188
270
  From Python:
189
271
  ```python
190
272
  from babelscribe.api import transcribe_file
191
- r = transcribe_file("talk.mp4", lang="auto", formats=["srt", "txt"]) # or accurate=True
273
+ r = transcribe_file("talk.mp4", lang="auto", formats=["srt", "txt"]) # or accurate=True, prompt="names, terms"
192
274
  print(r["lang"], r["device"], r["files"]); print(r["text"][:200])
275
+
276
+ from babelscribe.api import transcribe_many
277
+ done = transcribe_many(["a.mp4", "./recordings"], recursive=True, formats=["srt"]) # other options as above
278
+ print(done["succeeded"], done["failed"])
193
279
  ```
194
280
  Models download on first use to `~/.babelscribe/models` (`BABELSCRIBE_MODELS` to change). Hybrid fine-tunes are converted on your
195
281
  machine from their original Hugging Face repo — install `pip install "babelscribe[finetune]"` once; converted weights are never
196
282
  redistributed, so each fine-tune keeps its own licence. Thai word boundaries: `pip install "babelscribe[thai]"`.
197
283
 
284
+ ## Docker
285
+ No Python, ffmpeg or whisper.cpp on the host — the image has them, and the model is cached in a volume. There is no
286
+ published image yet, so build it from a checkout, then run it on the folder that holds your media:
287
+ ```bash
288
+ docker build -t babelscribe -f docker/Dockerfile .
289
+ docker run --rm -v "$PWD:/media" -v babelscribe-models:/models babelscribe talk.mp4 # writes talk.srt next to the input
290
+ ```
291
+ CPU by default, linux/amd64; a Vulkan image for GPU hosts is one `--build-arg` away. Details: [docker/README.md](docker/README.md).
292
+
293
+ ## Roadmap
294
+ What's planned next (real progress percentages, folders on the command line, verified downloads, more fine-tunes, burn-in subtitles, a desktop app) is in [ROADMAP.md](ROADMAP.md) and the [open issues](https://github.com/phonology024/babelscribe/issues).
295
+
198
296
  ## Add a language fine-tune
199
297
  Add one entry to `FINETUNES` in `babelscribe/models.py` (Hugging Face repo, language code, whether it needs beam search) and open a PR.
200
298
 
201
299
  ## Prebuilt binaries
202
300
  `.github/workflows/build-binaries.yml` builds `whisper-cli` + `whisper-quantize` for every row of the table above and attaches
203
- them to each `v*` release. Point `BABELSCRIBE_RELEASES` at another URL to self-host.
301
+ them to each `v*` release, with a `SHA256SUMS` file.
302
+
303
+ Each babelscribe version downloads the binaries of one fixed release (`BINARY_TAG` in `babelscribe/backend.py`), not
304
+ "latest", and checks the zip's sha256 before unpacking it. A download that does not match is deleted and nothing is
305
+ run. `babelscribe doctor` shows which release the cached binary came from and whether its files changed since.
306
+ Point `BABELSCRIBE_RELEASES` at another URL to self-host: a mirror of the official zips is checked the same way; a
307
+ mirror with your own builds needs `BABELSCRIBE_SKIP_VERIFY=1`.
204
308
 
205
309
  ## ภาษาไทย
206
310
  ใช้ผ่าน Claude Desktop ได้โดยไม่ต้องพิมพ์คำสั่ง: โหลด `babelscribe.mcpb` จากหน้า Releases แล้วดับเบิลคลิก จากนั้นพิมพ์ในแชทว่า *"ทำซับไทยให้คลิปล่าสุดในโฟลเดอร์ดาวน์โหลด"*
@@ -209,13 +313,17 @@ them to each `v*` release. Point `BABELSCRIBE_RELEASES` at another URL to self-h
209
313
  หรือเลือก Thonburian Whisper เอง: `--text-model thai-thonburian`
210
314
 
211
315
  ## Privacy Policy
212
- babelscribe runs entirely on your own computer. Last updated 2026-10-06.
316
+ babelscribe runs entirely on your own computer. Last updated 2026-11-10.
213
317
 
214
318
  - **Data collection:** none. babelscribe has no telemetry, analytics, accounts or crash reporting, and never uploads your
215
319
  audio, video, transcripts or file names anywhere.
216
320
  - **What it processes and where:** the media file you choose is converted and transcribed locally; subtitles and text are
217
321
  written to your disk (next to the file, or the folder you choose). Through MCP, the transcript text is returned to the AI
218
322
  app that called the tool — what that app does with it is governed by that app's own privacy policy.
323
+ - **Optional translation (`--translate-to`, off unless you ask):** the subtitle text is sent to the LLM endpoint you
324
+ run, which must be on this computer (`127.0.0.1` / `localhost`). It goes to another machine only if you pass
325
+ `--allow-remote` yourself (for the MCP server: `BABELSCRIBE_LLM_ALLOW_REMOTE=1` in its settings; an AI app cannot
326
+ switch it on). Audio and video are never sent.
219
327
  - **Network access (downloads only):** on first use it downloads the `whisper-cli` program from this project's GitHub
220
328
  releases, speech models from Hugging Face (`huggingface.co/ggerganov/whisper.cpp`, and for `--accurate` Thai/Hindi the
221
329
  fine-tune's own repository), and Python packages from PyPI when installed with pip/uv. These are plain downloads;
@@ -1,2 +1,2 @@
1
- """babelscribe — any language, any GPU speech-to-text built on whisper.cpp."""
2
- __version__ = "0.3.2"
1
+ """babelscribe — any language, any GPU speech-to-text built on whisper.cpp."""
2
+ __version__ = "0.5.0"
@@ -1,3 +1,3 @@
1
- from .cli import main
2
-
3
- main()
1
+ from .cli import main
2
+
3
+ main()