Detect subtitle sync offset using Whisper transcription
Project description
suba
Fix subtitle sync with Whisper, because
handgare for cowards.
You downloaded subtitles. The first line pops up during the studio logo. By the third act, characters are reacting to things that haven't happened yet. You've spent 20 minutes in VLC tapping keys and you're 90% sure you made it worse.
Suba rips a minute of audio from a dialogue-heavy part of your video, transcribes it with Whisper, matches the transcription against the subtitle file, and tells you the offset. Then it writes out a corrected SRT so you can stop thinking about this.
Install
You need ffmpeg and uv. Then:
uv tool install git+https://github.com/xy3/suba --with openai-whisper
That's it. One command — no clone, no build step.
Use
suba subs.srt movie.mkv -o fixed.srt
suba <subtitles> <video> -o <output.srt|vtt>
| Flag | What |
|---|---|
-o, --output |
Write corrected SRT/VTT |
-m, --model |
Whisper model (base, small, medium, large) |
-d, --duration |
Audio duration in seconds (default 60) |
-t, --start |
Manual start time in seconds |
--threshold |
Minimum similarity to accept a match (default 0.2) |
How it works
- Finds the densest 60 seconds of subtitles (more lines = more talking, probably)
- Extracts that audio with ffmpeg
- Transcribes it with Whisper
- Slides windows of the transcription over each candidate subtitle line, scoring by text similarity and timestamp proximity
- Shifts all timestamps by the detected offset and writes a fixed SRT
Project details
Release history Release notifications | RSS feed
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 suba-0.1.1.tar.gz.
File metadata
- Download URL: suba-0.1.1.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","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 |
877e189082a70c0c86c30b94ec850508e3443ead711823051e6a5374d8ed46f2
|
|
| MD5 |
65b0eeebb9ac6a879612b4b6f393dd34
|
|
| BLAKE2b-256 |
59e973dfb8f454b23cbc548095ed27a02079c639a8dcb215b47cf488d16417c5
|
File details
Details for the file suba-0.1.1-py3-none-any.whl.
File metadata
- Download URL: suba-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","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 |
8797799ce7cbb4e691a63519413942c7d595002cac609f78cb2786f121c4391d
|
|
| MD5 |
682ca7591573afb3945c093d4d7d730e
|
|
| BLAKE2b-256 |
6f6315de56bb43003afc06a764fcba86b0d580441f2f974f343cd691d8377662
|