Skip to content

Repository files navigation

AI Subtitle Generator

Free Windows-friendly Python app for generating subtitles from audio or video files using OpenAI Whisper. It supports a desktop GUI, command-line usage, MP4 audio extraction, language selection, and subtitle style presets.

Features

  • Desktop app with browse and drag-and-drop support
  • Command-line interface for repeatable workflows
  • MP3, WAV, M4A, FLAC, OGG, WMA, AAC, and MP4 input
  • MP4 audio extraction through FFmpeg
  • Whisper model selection: tiny, base, small, medium, large
  • Language auto-detect or manual language code selection
  • Subtitle styles: karaoke, short, standard, reading
  • SRT, timestamped TXT, and full transcript output
  • SRT caption text is cleaned of punctuation while SRT timestamps stay valid
  • Works locally with no API key

Requirements

  • Python 3.8+
  • FFmpeg installed and available in PATH

Install dependencies:

pip install -r requirements.txt

Verify FFmpeg:

ffmpeg -version

Desktop App

python app.py

Basic flow:

  1. Select or drag in an audio/video file.
  2. Choose model, language, subtitle style, and output formats.
  3. Click Generate Subtitles.
  4. Output files are saved beside the input file.

Command Line

Basic:

python main.py audio.mp3
python main.py video.mp4

Useful options:

python main.py audio.mp3 -m small
python main.py audio.mp3 --language auto
python main.py audio.mp3 --language ur
python main.py audio.mp3 --style karaoke
python main.py audio.mp3 --style standard -f srt
python main.py audio.mp3 -o output/my_subtitles

Available subtitle styles:

  • karaoke: 1-2 words per segment
  • short: 2-3 words per segment
  • standard: 3-5 words per segment
  • reading: 5-8 words per segment

Common language codes:

auto, en, ur, hi, ar, es, fr, de, it, pt, zh, ja, ko

Output Files

For audio.mp3, default output naming is based on the first 5 characters:

audio_subtitle.srt
audio_subtitle.txt
audio_subtitle_full.txt

SRT example:

1
00:00:00,000 --> 00:00:01,000
Watch the

2
00:00:01,000 --> 00:00:02,000
eyes

Build Windows EXE

Recommended:

.\venv\Scripts\python.exe -m PyInstaller AI-Subtitle-Generator.spec --clean

If the old EXE is locked, build into a fresh folder:

.\venv\Scripts\python.exe -m PyInstaller AI-Subtitle-Generator.spec --clean --workpath pyinstaller_work_manual --distpath dist_manual

Output:

dist_manual\AI-Subtitle-Generator.exe

What Changed Recently

  • Added language auto-detect and manual language selection.
  • Added subtitle style presets for karaoke, short, standard, and reading captions.
  • Changed default subtitle style to 1-2 word karaoke captions.
  • Removed punctuation from SRT caption text.
  • Kept SRT timestamp commas intact because they are required by the SRT format.
  • Fixed GUI model reloading so the selected Whisper model is reused when possible.
  • Updated docs for GUI and CLI usage.

Notes

  • First use may download the selected Whisper model.
  • Larger models are more accurate but slower and require more RAM.
  • If MP4 processing fails, confirm FFmpeg is installed and available in PATH.

Credits

  • OpenAI Whisper
  • FFmpeg

About

🎙️ Free AI Subtitle Generator - Convert MP4 videos & MP3 audio to SRT subtitles using OpenAI Whisper. Features desktop GUI with drag-and-drop, automatic video audio extraction, optimized 3-5 word subtitle segments with timestamps, and multiple output formats (SRT, TXT). Works completely offline, no API keys required. Perfect for content creators!

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages