Skip to main content

subtool

Local AI-powered subtitle generation and translation

PyPI Version Python Versions License UV Friendly CI Publish

Extract and translate video subtitles using Whisper and NLLB-200.

Features

  • Automatic speech recognition using OpenAI Whisper (auto-detects language)
  • Multi-language translation using Meta's NLLB-200 model
  • Subtitle embedding into video files (MP4 or MKV)
  • Multiple subtitle tracks with proper language naming
  • SRT and ASS format support (ASS for better Unicode/CJK character rendering)

Install

Recommended (fast, reproducible):

uv tool install subtool

Run without installing:

uvx subtool video.mp4 -t en es

With pip:

pip install subtool

Usage

# Basic usage - extract subtitles (auto-detect language)
subtool video.mp4

# Extract and translate to English and Spanish
subtool video.mp4 -t en es

# Specify source language explicitly
subtool video.mp4 -l zh -t en

# Use different Whisper model (default: turbo)
subtool video.mp4 -m large -t en

# Output as MKV (better subtitle support for Unicode/CJK)
subtool video.mp4 -t en zh -f mkv

# Generate SRT files only (no embedding)
subtool video.mp4 -t en es --srt-only

# Custom output path
subtool video.mp4 -t en -o output_with_subs.mp4

Supported Languages

Translation supports 12 common languages:

  • en - English
  • es - Spanish
  • fr - French
  • de - German
  • it - Italian
  • pt - Portuguese
  • ru - Russian
  • ja - Japanese
  • ko - Korean
  • zh - Chinese
  • ar - Arabic
  • hi - Hindi

More languages available in NLLB-200 documentation.

Whisper Models

Available models (trade-off between speed and accuracy):

  • tiny - Fastest, least accurate
  • base - Fast, decent accuracy
  • small - Balanced
  • medium - Good accuracy, slower
  • large - Best accuracy, slowest
  • turbo - Fast and accurate (default)

Output Formats

  • MP4 (default): Compatible but limited Unicode support for subtitles
  • MKV: Better subtitle support, recommended for Chinese/Japanese/Korean content

MKV uses ASS format with embedded font information for proper CJK character rendering.

Development

uv sync
uv run subtool video.mp4 -t en     # run the CLI using local code

# optional: editable install
uv pip install -e .

./scripts/release.sh            # release a new version

Notes

  • First run downloads Whisper model (~1.5GB for turbo) and NLLB-200 model (~1.2GB)
  • Models are cached in ~/.cache/huggingface/
  • Requires ffmpeg installed on your system
  • Generated subtitle files (.srt and .ass) are saved alongside the video
  • For best CJK (Chinese/Japanese/Korean) subtitle rendering, use MKV format (-f mkv)

Metadata

Release files for subtool 0.0.3

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

Source distribution (sdist)

Source distribution for subtool 0.0.3
File Size Uploaded Provenance Actions
subtool-0.0.3.tar.gz 9.7 kB Without provenance Details for subtool-0.0.3.tar.gz

Built distribution (wheel)

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

Total release size: 19.0 kB

Release files / subtool-0.0.3.tar.gz

Download URL subtool-0.0.3.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
50ed1445cf385040a3b1b0fa467e020a6b5c86670c762b2c25c23e0050603c9a
BLAKE2b-256 checksum
How to use checksums
857da009e642f98b6449d76a24693aa47b70db918395e7fa76cc29d0ca590bfa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.23

Release files / subtool-0.0.3-py3-none-any.whl

Download URL subtool-0.0.3-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
12254eee22f137bf6fe4189b15a9e05f8f8f6eaf52e7cbde83f4ab888f9c37ed
BLAKE2b-256 checksum
How to use checksums
b1330917529b160719b985a4b882d7fdedcee250fd2287c181678bb0c6fddc70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.23

Security for subtool 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files No provenance

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