Skip to content

๐ŸŽฌ AI-powered subtitle generator using OpenAI Whisper. Multi-language support, batch processing, GPU acceleration. Generate SRT/WebVTT subtitles instantly!

License

Notifications You must be signed in to change notification settings

msadeqsirjani/SubtitleGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฌ Interactive Video Subtitle Generator

๐ŸŒŸ Automatically generate and translate subtitles for your videos using AI!

License: MIT Python 3.9+ OpenAI Whisper

โœจ Features

  • ๐ŸŽ™๏ธ Advanced Speech Recognition: Powered by OpenAI's Whisper model
  • ๐ŸŒ Multi-language Support: Transcribe in 99+ languages
  • ๐Ÿ”„ Real-time Translation: Translate to 100+ languages
  • ๐Ÿ“ Multiple Formats: Export as SRT or WebVTT
  • ๐Ÿ“ฆ Batch Processing: Handle multiple videos at once
  • ๐Ÿ–ฅ๏ธ Interactive Console: Beautiful progress tracking
  • โšก GPU Acceleration: Optional CUDA support for faster processing
  • ๐ŸŽฏ High Accuracy: State-of-the-art speech recognition

๐Ÿš€ Quick Start

Prerequisites

  • ๐Ÿ Python 3.9 or higher
  • ๐ŸŽต FFmpeg
  • ๐ŸŽฎ CUDA-compatible GPU (optional, for faster processing)

Installation

  1. Clone the repository:
git clone https://github.com/msadeqsirjani/SubtitleGenerator.git
cd SubtitleGenerator
  1. Install dependencies:
pip install -r requirements.txt
  1. Install FFmpeg:
  • ๐ŸŽ macOS:
    brew install ffmpeg
  • ๐Ÿง Linux:
    sudo apt-get install ffmpeg
  • ๐ŸชŸ Windows: Download from FFmpeg website

๐Ÿ’ก Usage

Single Video Processing

python main.py --input video.mp4 --output subtitles.srt --language en

Batch Processing

python main.py --input_dir videos/ --output_dir subtitles/ --language en

Command Line Options

Option Description Example
--input ๐Ÿ“ Input video file --input video.mp4
--input_dir ๐Ÿ“‚ Input directory --input_dir videos/
--output ๐Ÿ“ Output subtitle file --output subs.srt
--output_dir ๐Ÿ“‚ Output directory --output_dir subtitles/
--language ๐ŸŒ Target language code --language es
--model ๐Ÿค– Whisper model size --model base
--format ๐Ÿ“„ Output format --format srt
--gpu โšก Use GPU acceleration --gpu

Available Models

Model Size Memory Relative Speed
tiny 39M 1GB 32x
base 74M 1GB 16x
small 244M 2GB 6x
medium 769M 5GB 2x
large 1550M 10GB 1x

๐Ÿ“ Project Structure

SubtitleGenerator/
โ”œโ”€โ”€ ๐Ÿ“œ main.py              # Main entry point
โ”œโ”€โ”€ ๐Ÿ“‚ src/
โ”‚   โ”œโ”€โ”€ ๐ŸŽ™๏ธ transcriber.py   # Speech recognition
โ”‚   โ”œโ”€โ”€ ๐ŸŒ translator.py    # Translation service
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ formatter.py     # Subtitle formatting
โ”‚   โ””โ”€โ”€ ๐Ÿ› ๏ธ utils.py         # Utility functions
โ”œโ”€โ”€ ๐Ÿ“‹ requirements.txt     # Dependencies
โ””โ”€โ”€ ๐Ÿ“– README.md           # Documentation

๐ŸŽฏ Examples

Basic Usage

# Generate English subtitles
python main.py --input lecture.mp4 --output lecture.srt

# Generate Spanish subtitles with GPU acceleration
python main.py --input video.mp4 --output video_es.srt --language es --gpu

# Process all videos in a directory
python main.py --input_dir courses/ --output_dir subtitles/ --language fr

Advanced Usage

# Use a larger model for better accuracy
python main.py --input interview.mp4 --output subs.srt --model large --gpu

# Generate WebVTT format
python main.py --input video.mp4 --output video.vtt --format vtt

# Process videos with specific model and language
python main.py --input_dir videos/ --output_dir subs/ --model medium --language ja --gpu

๐Ÿค Contributing

We welcome contributions! Here's how you can help:

  1. ๐Ÿด Fork the repository
  2. ๐ŸŒฟ Create your feature branch (git checkout -b feature/amazing-feature)
  3. ๐Ÿ’พ Commit your changes (git commit -m 'Add amazing feature')
  4. ๐Ÿ“ค Push to the branch (git push origin feature/amazing-feature)
  5. ๐ŸŽ Open a Pull Request

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • ๐ŸŽฏ OpenAI Whisper for the amazing speech recognition model
  • ๐ŸŒ Google Translate for translation services
  • ๐ŸŽจ Rich for the beautiful console interface

๐Ÿ“š Documentation

For more detailed information, check out our Wiki or the following guides:

๐Ÿ› Bug Reports

Found a bug? Please open an issue with:

  1. ๐Ÿ” Description of the issue
  2. ๐Ÿ“‹ Steps to reproduce
  3. ๐Ÿ–ฅ๏ธ System information
  4. ๐Ÿ“Ž Error logs (if any)

๐Ÿ“ซ Contact

Have questions? Feel free to:

  • ๐Ÿ“ฎ Open an issue
  • ๐ŸŒŸ Star the repository
  • ๐Ÿ”— Connect with contributors

Made with โค๏ธ by the Open Source Community

About

๐ŸŽฌ AI-powered subtitle generator using OpenAI Whisper. Multi-language support, batch processing, GPU acceleration. Generate SRT/WebVTT subtitles instantly!

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages