Skip to main content

Simple Auto Subtitle (Coauthor: Claude)

Automatic subtitle generation tool that extracts audio from video files and generates subtitles using Google's Gemini AI models.

Features

  • Audio Extraction: Automatically extracts audio from video files using ffmpeg
  • AI Transcription: Uses Gemini 2.5 models (Flash or Pro) for accurate speech-to-text with precise timestamps
  • Multiple Output Formats:
    • .srt subtitle files
    • Videos with embedded subtitles (toggleable)
    • Videos with burnt-in subtitles (permanent)
    • Extracted audio files (.wav)
  • Model Selection: Choose between Gemini Flash 2.5 (faster) or Pro 2.5 (more accurate)
  • Structured Output: Uses Pydantic models for reliable JSON parsing
  • Environment Variables: Supports .env files for API key management

Installation

pip install simple-auto-subtitle

From Source

git clone https://github.com/yunfanye/auto_subtitle.git
cd auto_subtitle
pip install -e .

Development Installation

git clone https://github.com/yunfanye/auto_subtitle.git
cd auto_subtitle
pip install -r requirements.txt
pip install -e .

Setup

  1. Install ffmpeg (required for audio/video processing):

    • macOS: brew install ffmpeg
    • Ubuntu: sudo apt install ffmpeg
    • Windows: Download from ffmpeg.org
  2. Set up Gemini API Key: Create a .env file in your working directory:

    GEMINI_API_KEY=your_api_key_here
    

Usage

Basic Usage

# Process default video (test.mp4) with Flash model
simple-auto-subtitle

# Process specific video file  
simple-auto-subtitle my_video.mp4

# Use Pro model for better accuracy
simple-auto-subtitle my_video.mp4 --model pro

# Alternative command
auto-subtitle my_video.mp4

Command Line Options

simple-auto-subtitle [video_file] [options]

Arguments:
  video_file              Video file to process (default: test.mp4)

Options:
  --api-key API_KEY       Gemini API key (or set GEMINI_API_KEY env var)
  --output, -o OUTPUT     Output SRT file path (default: video_name.srt)
  --model {flash,pro}     Gemini model: flash (faster) or pro (more accurate)

Output Files

For input video my_video.mp4, the tool generates:

  • my_video.srt - Standard subtitle file
  • my_video.wav - Extracted audio file
  • my_video_embedded.mp4 - Video with embedded subtitles (can be toggled on/off)
  • my_video_captioned.mp4 - Video with burnt-in subtitles (always visible)

Model Comparison

Model Speed Accuracy Cost Best For
Flash Fast Good Lower Quick processing, bulk videos
Pro Slower Better Higher High-quality transcription, important content

Requirements

  • Python 3.8+
  • ffmpeg
  • Google Gemini API key
  • Required Python packages: google-genai, pydantic, python-dotenv

Metadata

Release files for simple-auto-subtitle 0.1.0

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

Source distribution (sdist)

Source distribution for simple-auto-subtitle 0.1.0
File Size Uploaded Provenance Actions
simple_auto_subtitle-0.1.0.tar.gz 68.9 MB Without provenance Details for simple_auto_subtitle-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for simple-auto-subtitle 0.1.0
File Interpreter ABI Platform Actions
simple_auto_subtitle-0.1.0-py3-none-any.whl Python 3 none any Details for simple_auto_subtitle-0.1.0-py3-none-any.whl

Total release size: 68.9 MB

Release files / simple_auto_subtitle-0.1.0.tar.gz

Download URL simple_auto_subtitle-0.1.0.tar.gz
Size 68.9 MB
Tags Source
SHA-256 checksum
How to use checksums
b9a6d70d86531ecb64500b1f9ec209d7a5a4f5b157455e8892308fa6287d2690
BLAKE2b-256 checksum
How to use checksums
a1a509b26efdbaf7c9053937a4b5a384b473dbd69f6788f73f1ad6f4ad3074b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Release files / simple_auto_subtitle-0.1.0-py3-none-any.whl

Download URL simple_auto_subtitle-0.1.0-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ce64160ac1f34bef88424bc3827dc633adc88a268fce83dcdef104c98a6a1e8
BLAKE2b-256 checksum
How to use checksums
70f6c0ad6f120e8294faff437d9b6484767482909b68230424491e63915e722f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Security for simple-auto-subtitle 0.1.0

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.1.0 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