subtitlemaker 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,207 @@
1
+ Metadata-Version: 2.5
2
+ Name: subtitlemaker
3
+ Version: 0.1.0
4
+ Summary: Generate subtitles from audio and video files using faster-whisper.
5
+ Project-URL: Homepage, https://github.com/CodeByVibes/subtitlemaker
6
+ Project-URL: Issues, https://github.com/CodeByVibes/subtitlemaker/issues
7
+ Project-URL: Changelog, https://github.com/CodeByVibes/subtitlemaker/blob/main/CHANGELOG.md
8
+ Author-email: Johan Isevind <codebyvibes@isevind.se>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: faster-whisper,speech-to-text,srt,subtitles,transcription,vtt,whisper
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: End Users/Desktop
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
22
+ Classifier: Topic :: Multimedia :: Video
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: av<17,>=13
25
+ Requires-Dist: faster-whisper>=1.2.1
26
+ Requires-Dist: rich>=13
27
+ Requires-Dist: tomli>=2; python_version < '3.11'
28
+ Provides-Extra: cuda
29
+ Requires-Dist: nvidia-cublas-cu12; extra == 'cuda'
30
+ Requires-Dist: nvidia-cudnn-cu12==9.*; extra == 'cuda'
31
+ Description-Content-Type: text/markdown
32
+
33
+ # SubtitleMaker
34
+
35
+ [![CI](https://github.com/CodeByVibes/subtitlemaker/actions/workflows/ci.yml/badge.svg)](https://github.com/CodeByVibes/subtitlemaker/actions/workflows/ci.yml)
36
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
37
+
38
+ Generate subtitles from audio and video files with [faster-whisper](https://github.com/SYSTRAN/faster-whisper).
39
+ It runs locally, on a GPU if you have one and on the CPU if you don't.
40
+
41
+ ```console
42
+ $ subtitlemaker interview.mkv
43
+ $ ls
44
+ interview.mkv interview.srt
45
+ ```
46
+
47
+ - **SRT, WebVTT and plain text** output, any combination in one run.
48
+ - **Subtitles that follow the speech.** Cues start at the first word and end at the last, using word timestamps, and long sentences are split at sentence ends where possible.
49
+ - **Readable by default:** at most two lines of 42 characters, 20 characters per second, 1 to 7 seconds on screen. All of it is configurable.
50
+ - **Batch mode:** pass many files or whole folders; the model is loaded once and one bad file doesn't stop the rest.
51
+ - **GPU or CPU.** `--device auto` uses an NVIDIA GPU when there is one and falls back to the CPU when there isn't.
52
+ - **Mixed-language audio** (`-l en,sv`), and optional translation to English (`-t translate`).
53
+
54
+ ## Install
55
+
56
+ You need Python 3.10 to 3.13. FFmpeg is **not** required.
57
+
58
+ SubtitleMaker is a command line tool, so [pipx](https://pipx.pypa.io/) or [uv](https://docs.astral.sh/uv/) is the easiest way to install it:
59
+
60
+ ```console
61
+ # CPU only
62
+ pipx install subtitlemaker
63
+
64
+ # NVIDIA GPU (also installs the CUDA 12 libraries, see below)
65
+ pipx install "subtitlemaker[cuda]"
66
+ ```
67
+
68
+ With uv: `uv tool install subtitlemaker` or `uv tool install "subtitlemaker[cuda]"`. Plain `pip install` works too, ideally inside a virtual environment.
69
+
70
+ > **Platforms:** developed and tested on Linux. It should work on macOS and Windows on the CPU, but that has not been tested yet. GPU support is only set up for Linux.
71
+
72
+ ### The first run downloads a model
73
+
74
+ Whisper models are downloaded from Hugging Face the first time you use them and cached afterwards (`~/.cache/huggingface`, or wherever `HF_HOME` points). Sizes of the model files:
75
+
76
+ | `--model` | Download | Notes |
77
+ | ------------ | -------- | ---------------------------------------------- |
78
+ | `tiny` | 73 MB | Fast, rough. Good for trying things out. |
79
+ | `small` | 462 MB | **Default on CPU.** |
80
+ | `turbo` | 1.6 GB | Close to `large-v3` quality, much faster. |
81
+ | `large-v3` | 2.9 GB | **Default on GPU.** Most accurate. |
82
+
83
+ `base`, `medium`, the `.en` variants, `distil-*` models, any Hugging Face repo id such as `user/model`, and local paths to converted models also work.
84
+
85
+ ## Usage
86
+
87
+ ```console
88
+ # Subtitles next to the file, in the spoken language
89
+ subtitlemaker talk.mp4
90
+
91
+ # Several formats at once: talk.srt, talk.vtt and talk.txt
92
+ subtitlemaker talk.mp4 -f srt,vtt,txt
93
+
94
+ # English subtitles for foreign-language audio
95
+ subtitlemaker film.mkv -t translate
96
+
97
+ # Tell it the language instead of detecting it
98
+ subtitlemaker film.mkv -l sv
99
+
100
+ # A whole folder (add -r for sub folders), skipping files that are already done
101
+ subtitlemaker ~/Videos --skip-existing -r
102
+
103
+ # Put all the results in one place
104
+ subtitlemaker ~/Videos/*.mp4 -d ~/subtitles -f srt,vtt
105
+
106
+ # Smaller and faster, CPU only
107
+ subtitlemaker talk.mp4 --device cpu --model tiny
108
+ ```
109
+
110
+ Run `subtitlemaker --help` for every option.
111
+
112
+ ### Output
113
+
114
+ | Format | Contents |
115
+ | ------ | -------------------------------------------------------------------------------- |
116
+ | `srt` | SubRip, the most widely supported. This is the default. |
117
+ | `vtt` | WebVTT, for web players. Markup characters in the text are escaped. |
118
+ | `txt` | The text only, one subtitle per line, no timing. |
119
+
120
+ Files are written next to each input and named after it (`talk.mp4` becomes `talk.srt`). Existing files are overwritten unless you pass `--skip-existing`.
121
+
122
+ - `-o FILE` names the output for a single input. With several formats it is a base name and the extension is replaced for each one.
123
+ - `-d DIR` writes all outputs into one folder (created if needed). Two inputs that would write the same file are refused before anything runs.
124
+
125
+ The exit code is `0` when everything succeeded, `1` if any file failed (the others are still processed), and `2` for invalid options.
126
+
127
+ ### Languages
128
+
129
+ By default Whisper detects the language from the start of each file. If it guesses wrong, or the start is music, name the language with `-l`.
130
+
131
+ For audio that switches language, list the languages (`-l en,sv`) or add `-m`. The language is then re-detected for every segment. Be aware that `-t translate` turns every segment into English.
132
+
133
+ ### Subtitle style
134
+
135
+ | Option | Default | Meaning |
136
+ | ------------------- | ------- | ---------------------------------------------------- |
137
+ | `--max-line-length` | 42 | Maximum characters per line. |
138
+ | `--max-lines` | 2 | Lines per subtitle, 1 or 2. |
139
+ | `--max-cps` | 20 | Reading speed: characters per second. |
140
+ | `--min-duration` | 1.0 | Shortest time a subtitle stays on screen (seconds). |
141
+ | `--max-duration` | 7.0 | Longest time a subtitle stays on screen (seconds). |
142
+ | `--min-gap` | 0.05 | Smallest gap between two subtitles (seconds). |
143
+
144
+ Timing follows the speech. A subtitle appears when its first word is spoken. If it would be too short or too quick to read, it is held longer, but only into free time: it never delays or overlaps the next subtitle. If two lines are spoken too close together, the first one is allowed to be shorter than `--min-duration`.
145
+
146
+ ### Config file
147
+
148
+ Options you always use can go in `~/.config/subtitlemaker/config.toml` (or `$XDG_CONFIG_HOME/subtitlemaker/config.toml`), or in a file given with `--config`. Command line options override the file, and the file overrides the defaults.
149
+
150
+ ```toml
151
+ [style]
152
+ max_line_length = 38
153
+ max_lines = 2
154
+ max_cps = 17
155
+ min_duration = 1.0
156
+ max_duration = 6.0
157
+ min_gap = 0.05
158
+
159
+ [model]
160
+ name = "turbo" # auto, a size, a Hugging Face repo id or a path
161
+ device = "auto" # auto, cuda or cpu
162
+ compute_type = "auto" # auto, float16, int8_float16, int8, float32, ...
163
+ word_timestamps = true
164
+ vad_filter = true
165
+ condition_on_previous_text = true
166
+ ```
167
+
168
+ Unknown keys and wrong types are reported with the file name, so typos don't pass silently.
169
+
170
+ ## GPU and CPU
171
+
172
+ `--device auto` (the default) picks the GPU when CTranslate2 can see one and warns and uses the CPU otherwise.
173
+
174
+ | Where | Default model | Precision | Notes |
175
+ | ----- | ------------- | --------- | --------------------------------------------------- |
176
+ | GPU | `large-v3` | `float16` | Needs an NVIDIA GPU, a current driver and CUDA 12 libraries. |
177
+ | CPU | `small` | `int8` | Works everywhere, much slower than a GPU. |
178
+
179
+ For a rough idea, on one machine (RTX 4070 Laptop GPU, 24 CPU cores) a two minute clip took about 7 seconds with `large-v3` on the GPU and about 9 seconds with `small` on the CPU. Your results will differ.
180
+
181
+ ### CUDA libraries
182
+
183
+ CTranslate2 needs the CUDA 12 versions of cuBLAS and cuDNN 9. Install SubtitleMaker with the `cuda` extra and they come from PyPI (`nvidia-cublas-cu12`, `nvidia-cudnn-cu12`) and are loaded automatically, so a different system-wide CUDA version doesn't matter. These packages are licensed by NVIDIA, not under this project's license, and they are large.
184
+
185
+ If the GPU can't be used, `--device auto` falls back to the CPU and tells you why. With an explicit `--device cuda` it stops with an error that says what is missing.
186
+
187
+ ## How it works
188
+
189
+ 1. faster-whisper transcribes the audio with word timestamps (voice activity detection is on, so stretches without speech are skipped).
190
+ 2. Words are grouped into subtitles that fit the line limits, preferably breaking at the end of a sentence.
191
+ 3. Timing is adjusted for readability without moving speech, as described above.
192
+ 4. The result is written in each requested format.
193
+
194
+ ## Limitations
195
+
196
+ - At most two lines per subtitle.
197
+ - Lines are wrapped at spaces, so languages written without spaces (Chinese, Japanese, Thai) are not wrapped well. This is untested.
198
+ - Speakers are not identified, and no sound descriptions like `[music]` are added.
199
+ - A long pause in the middle of a sentence does not split the subtitle yet.
200
+
201
+ ## Contributing
202
+
203
+ Bug reports and pull requests are welcome, see [CONTRIBUTING.md](CONTRIBUTING.md). Changes are listed in [CHANGELOG.md](CHANGELOG.md).
204
+
205
+ ## License
206
+
207
+ [MIT](LICENSE). SubtitleMaker builds on [faster-whisper](https://github.com/SYSTRAN/faster-whisper) (MIT), [CTranslate2](https://github.com/OpenNMT/CTranslate2) (MIT) and OpenAI's [Whisper](https://github.com/openai/whisper) models (MIT).
@@ -0,0 +1,20 @@
1
+ subtitlemaker/__init__.py,sha256=OV7wpXd3VCky4qYVRXVIaQKBqt3B55P2CIszQfaJ7AA,101
2
+ subtitlemaker/__main__.py,sha256=59aDaU6vF5T5yU4GG5fixwJE8SRCg7CSpf5pc9-Vu-A,88
3
+ subtitlemaker/_cuda.py,sha256=d1EXja1f7eTmBD8RkzpRJiRhc7lTLwHFRl0HlXg_IiM,2438
4
+ subtitlemaker/cli.py,sha256=yHuqNvmr-mZ9I4eKybQls_3mcFybfMSqjBrJh5SHMs0,20215
5
+ subtitlemaker/config.py,sha256=IItLUrMK6CZiT0Fh3f6_fmlgqbjKOiXIi0NxE4P45B4,4979
6
+ subtitlemaker/log.py,sha256=s0-fzhay68q2iFXJheQ2b-HSLl9ifEObBWAjMNu9a5o,2315
7
+ subtitlemaker/media.py,sha256=p_iPCbsv3U75a9KMOu_d6b34ervKFFueupGCH8FNmhM,1386
8
+ subtitlemaker/progress.py,sha256=8iLxRDjmPx3zdmLv9E28My04MccbRZDISCCuqjMo22Y,2591
9
+ subtitlemaker/segmenter.py,sha256=Fx7EkXsYlAWBAFvomu2MsB6Tl89pvSwn1FtJwGOkpMo,7629
10
+ subtitlemaker/transcribe.py,sha256=vKE2ZRMdanSiCbQrFOG9GvOU0MIQzGWAOW2RjSdKDUQ,6652
11
+ subtitlemaker/formats/__init__.py,sha256=aWh8waQVZBwWElEXckR8PPRli70tNKP8Ski9j7js3oQ,1954
12
+ subtitlemaker/formats/_timestamp.py,sha256=nKb1OhiAF4WhEnbS0H6Z6_1L9EAvHiC46jgseekSy8k,557
13
+ subtitlemaker/formats/srt.py,sha256=dZ5zhbOHWkIcTYxx4ydYoIH1DIA953zFWSOvSNrgF3Y,660
14
+ subtitlemaker/formats/txt.py,sha256=dkCJWg8otpdmVIbeikB33MZPjhIkUgY7fvEyzCojZcA,315
15
+ subtitlemaker/formats/vtt.py,sha256=nGZHOCtlkixBq6UHqWX6Ns-bb5jHFd64yeVqSUNXpeo,879
16
+ subtitlemaker-0.1.0.dist-info/METADATA,sha256=ilogAd82gYyyHT4X6b8zt6BR1NXntovMY76fuH6XjNY,10461
17
+ subtitlemaker-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
18
+ subtitlemaker-0.1.0.dist-info/entry_points.txt,sha256=qwxkXtKC9SfmjG3hAPT1fsm6xmq29VKsoKwHz9B9QUU,57
19
+ subtitlemaker-0.1.0.dist-info/licenses/LICENSE,sha256=HOAkSCzCa-PODi7QJ0Z3mmLmh7MdlNGDs9xJ4ZLQ3bc,1070
20
+ subtitlemaker-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ subtitlemaker = subtitlemaker.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Johan Isevind
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.