Skip to main content

Transcribe videos to ASS subtitle files in 99 languages using faster-whisper

Project description

whispersub

Transcribe video files to ASS subtitle files using faster-whisper. Whisper detects the spoken language automatically and supports 99 languages, including English, Spanish, French, German, Japanese, Chinese, Arabic, Hindi, and many more.

  • NVIDIA GPU acceleration with automatic CPU fallback
  • Batch mode: pass multiple video files or directory trees
  • Surround-sound audio extraction (dialogue-channel aware)
  • Word-level timestamps with balanced line breaking
  • Per-word confidence colour coding in the terminal

Requirements

Python 3.10+. Works on Linux, Windows, and macOS. No system FFmpeg needed — PyAV bundles its own. Supports MKV, MP4, AVI, MOV, WebM, TS, and other common video formats.

Install

pip install whispersub

GPU acceleration (Linux/Windows — requires an NVIDIA GPU with CUDA 12):

pip install whispersub[gpu]

Without [gpu], whispersub falls back to CPU automatically if CUDA is unavailable.

On first run, whispersub downloads the Whisper large-v3-turbo model (~800 MB) from Hugging Face and caches it locally.

Usage

# Single file — writes movie.en.ass alongside the video
whispersub movie.mkv

# Explicit output directory
whispersub movie.mkv --output-dir ~/subs

# Whole directory, force overwrite
whispersub /media/shows --force

# File with multiple audio tracks — inspect layouts, then pick one track
whispersub series.mkv --list-audio-tracks
whispersub series.mkv --audio-track 2

Options

Option Default Description
--audio-track N auto Audio track index (required if the file has multiple tracks)
--list-audio-tracks off Show audio tracks for all input videos, grouped by configuration, and exit
--colour-by probability Per-word terminal colour coding: probability or duration
--font-size N 48 Font size (1280×720 canvas; player scales to actual resolution)
--force off Overwrite existing subtitle files
--limit N Stop after N segments per video (useful for testing)
--max-line-count N 2 Maximum subtitle lines per card
--max-line-width N 36 Maximum characters per line
--max-threads N all cores CPU thread limit
--output-dir DIR alongside video Write all subtitle files to this directory

Output

Subtitle files are named <stem>.<language>.ass, e.g. movie.en.ass. The detected language comes from Whisper. Output is compatible with VLC, mpv, IINA, MPC-HC, and other players that support ASS/SSA subtitles.

We chose ASS over SRT for better-looking subtitles: font sizing scales correctly to any resolution, and line breaks are balanced for readability. It also allows us to preserve word-level timing, so the file can be post-processed or reformatted without re-transcribing.

Licence

MIT

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

whispersub-1.2.0.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

whispersub-1.2.0-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file whispersub-1.2.0.tar.gz.

File metadata

  • Download URL: whispersub-1.2.0.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for whispersub-1.2.0.tar.gz
Algorithm Hash digest
SHA256 69db27d199c2983dc94fac55c50220ec0afa97177acc5733bc416130c5620ec5
MD5 09869b222c025452581547830b2de145
BLAKE2b-256 5451b05d86326e588433bc69251906c1e2e779187fdc5c863988012335eb7271

See more details on using hashes here.

Provenance

The following attestation bundles were made for whispersub-1.2.0.tar.gz:

Publisher: publish.yml on zvea/whispersub

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file whispersub-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: whispersub-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for whispersub-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9fa3a0de6ce1714098d24cd176b7442712a8e9bca264f1ee55de02f43da9125a
MD5 532ef9dcbea253738b1859f02a53455f
BLAKE2b-256 b43fede5e65bf3bec67cce52fbc951f640431baf01ee4a285b064358bcab4132

See more details on using hashes here.

Provenance

The following attestation bundles were made for whispersub-1.2.0-py3-none-any.whl:

Publisher: publish.yml on zvea/whispersub

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page