🌟 Automatically generate and translate subtitles for your videos using AI!
- 🎙️ 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
- 🐍 Python 3.9 or higher
- 🎵 FFmpeg
- 🎮 CUDA-compatible GPU (optional, for faster processing)
- Clone the repository:
git clone https://github.com/msadeqsirjani/SubtitleGenerator.git
cd SubtitleGenerator- Install dependencies:
pip install -r requirements.txt- Install FFmpeg:
- 🍎 macOS:
brew install ffmpeg
- 🐧 Linux:
sudo apt-get install ffmpeg
- 🪟 Windows: Download from FFmpeg website
python main.py --input video.mp4 --output subtitles.srt --language enpython main.py --input_dir videos/ --output_dir subtitles/ --language en| 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 |
| 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 |
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
# 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# 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 --gpuWe welcome contributions! Here's how you can help:
- 🍴 Fork the repository
- 🌿 Create your feature branch (
git checkout -b feature/amazing-feature) - 💾 Commit your changes (
git commit -m 'Add amazing feature') - 📤 Push to the branch (
git push origin feature/amazing-feature) - 🎁 Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- 🎯 OpenAI Whisper for the amazing speech recognition model
- 🌐 Google Translate for translation services
- 🎨 Rich for the beautiful console interface
For more detailed information, check out our Wiki or the following guides:
Found a bug? Please open an issue with:
- 🔍 Description of the issue
- 📋 Steps to reproduce
- 🖥️ System information
- 📎 Error logs (if any)
Have questions? Feel free to:
- 📮 Open an issue
- 🌟 Star the repository
- 🔗 Connect with contributors
Made with ❤️ by the Open Source Community