Convert fast-whisper STT result JSON to WebVTT
Project description
stt2vtt
Convert fast-whisper STT results with timestamps to WebVTT. Input is a list of segments (or a JSON string of that list) from faster-whisper or compatible segment + word timestamps. Output is VTT text.
No audio processing or ML models — this repo only converts existing STT JSON to VTT.
Installation
pip install stt2vtt
Dev dependencies:
pip install stt2vtt[dev]
Usage
CLI
# From file (writes <stem>.vtt in current directory by default)
stt2vtt result.json
# → result.vtt
# Custom output path
stt2vtt result.json -o output.vtt
# From stdin
cat result.json | stt2vtt -o output.vtt
Python
import stt2vtt
# Call the package: list of segments, or JSON string of that list (fast-whisper format)
vtt = stt2vtt('[{"start": 0, "end": 1.5, "text": " Hello world.", "words": [{"start": 0, "end": 0.5, "word": " Hello"}, {"start": 0.5, "end": 1.5, "word": " world."}]}]')
print(vtt) # "WEBVTT\n\n00:00:00.000 --> ..."
Input format (fast-whisper)
Input must be a list of segments or a JSON string of that list (no wrapper object).
Minimal schema:
- Segment:
start,end(seconds),text,words(list, default[]). - Word (each item in
words):start,end,word.
Extra fields in the JSON are ignored. See tests/test_data/jp2-input.json for the formal format.
Example:
[
{
"start": 0.0,
"end": 1.5,
"text": " Hello world.",
"words": [
{ "start": 0.0, "end": 0.5, "word": " Hello" },
{ "start": 0.5, "end": 1.5, "word": " world." }
]
}
]
Segments without words are allowed; one VTT cue is emitted per segment using segment start, end, and text.
Output
WebVTT subtitle content: a WEBVTT header plus timestamped cues. Sentence boundaries are split on punctuation; the first letter of each cue is capitalized.
Example (from the input above):
WEBVTT
00:00:00.000 --> 00:00:01.500
Hello world
License
MIT — see LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stt2vtt-0.0.5.tar.gz.
File metadata
- Download URL: stt2vtt-0.0.5.tar.gz
- Upload date:
- Size: 117.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cdae0d27ca9028b66da4658e0820db1397dc02b45422c8db540e3813a5d9fe34
|
|
| MD5 |
0ffce96d71c9986fc341bdb78bf7ee4f
|
|
| BLAKE2b-256 |
e0bdcc2c6be2837f31a3fb50fbc7a37050aaa6b8406f04958da2874f30ffa00f
|
File details
Details for the file stt2vtt-0.0.5-py3-none-any.whl.
File metadata
- Download URL: stt2vtt-0.0.5-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e5ef6dcf3921967abe88a5a922cf951a6bf9802d8e63937a891b243e0e48d5c
|
|
| MD5 |
c10f7e27f14df15860bc403c7081d1f6
|
|
| BLAKE2b-256 |
e2075915e03dc0e136dd3853ad3961fa0109570b8188fcbe7115abe8bb0d3d31
|