๐ 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 en
python 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 --gpu
We 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