Skip to main content

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.

Metadata

Release files for stt2vtt 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stt2vtt 0.0.5
File Size Uploaded
stt2vtt-0.0.5.tar.gz 117.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stt2vtt 0.0.5
File Interpreter ABI Platform
stt2vtt-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 125.2 kB

Release files / stt2vtt-0.0.5.tar.gz

Download URL stt2vtt-0.0.5.tar.gz
Size 117.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cdae0d27ca9028b66da4658e0820db1397dc02b45422c8db540e3813a5d9fe34
BLAKE2b-256 checksum
How to use checksums
e0bdcc2c6be2837f31a3fb50fbc7a37050aaa6b8406f04958da2874f30ffa00f
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / stt2vtt-0.0.5-py3-none-any.whl

Download URL stt2vtt-0.0.5-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e5ef6dcf3921967abe88a5a922cf951a6bf9802d8e63937a891b243e0e48d5c
BLAKE2b-256 checksum
How to use checksums
e2075915e03dc0e136dd3853ad3961fa0109570b8188fcbe7115abe8bb0d3d31
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page