An AI-powered YouTube subtitle generator that uses OpenAI's Whisper model to automatically transcribe videos in any language to English subtitles. This project consists of a Python Flask backend server and a Chrome extension that seamlessly integrates with YouTube to generate high-quality subtitles.
- π€ AI-Powered Transcription: Uses OpenAI's Whisper model for accurate speech-to-text conversion
- π Multi-Language Support: Transcribes videos in any language and translates to English
- β‘ Real-Time Processing: Fast subtitle generation with multiple model size options
- π― Browser Integration: Chrome extension automatically detects YouTube videos
- π Easy Export: Download subtitles in standard SRT format
- π One-Click Operation: Generate subtitles with a single button click
- π¨ Modern UI: Clean, intuitive interface with real-time status updates
SubtitleAI-Pro-Extension/
βββ π Extension/ # Chrome Extension
β βββ manifest.json # Extension configuration
β βββ popup.html # Extension popup interface
β βββ popup.js # Extension popup logic
β βββ content.js # YouTube page integration
β βββ background.js # Background service worker
β βββ styles.css # Extension styling
β βββ π icons/ # Extension icons
βββ π downloads/ # Temporary audio files
βββ π Preview/ # Screenshots of the application
βββ gen.py # Core subtitle generation logic
βββ server.py # Flask backend server
βββ requirements.txt # Python dependencies
βββ README.md # This file
- Python 3.8+: Core programming language
- Flask: Web framework for API server
- Flask-CORS: Cross-origin resource sharing
- faster-whisper: Optimized Whisper implementation
- pytubefix: YouTube video downloading
- OpenAI Whisper: AI transcription model
- Chrome Extension API: Browser integration
- JavaScript ES6+: Extension logic
- HTML5/CSS3: User interface
- Chrome Manifest V3: Modern extension framework
Before you begin, ensure you have the following installed:
- Python 3.8 or higher
- pip (Python package installer)
- Google Chrome browser
- Internet connection (for downloading Whisper models)
git clone SubtitleAI-Pro-Extension
cd SubtitleAI-Pro-Extension
# Create virtual environment (recommended)
python -m venv Sub
cd Sub
Scripts\activate # On Windows
# Install dependencies
pip install -r requirements.txt
python server.py
You should see:
π Starting YouTube Subtitle Generator Server...
π‘ Server will run on http://localhost:5000
π¬ Ready to generate subtitles!
--------------------------------------------------
* Running on http://localhost:5000
- Open Google Chrome
- Navigate to
chrome://extensions/
- Enable "Developer mode" (toggle in top-right corner)
- Click "Load unpacked"
- Select the
Extension
folder from this project - The extension icon should appear in your Chrome toolbar
- Navigate to any YouTube video
- Click the SubtitleAI-Pro-Extension icon
- Select your preferred model size:
- Tiny: Fastest, lower accuracy
- Base: Good balance (recommended)
- Small: Better accuracy
- Medium: High accuracy
- Large: Best accuracy, slower
- Click "Generate Subtitles"
- Wait for processing to complete
- Download the generated SRT file
Model | Size | Speed | Accuracy | Use Case |
---|---|---|---|---|
Tiny | ~39 MB | β‘β‘β‘β‘β‘ | βββ | Quick previews |
Base | ~74 MB | β‘β‘β‘β‘ | ββββ | Recommended |
Small | ~244 MB | β‘β‘β‘ | ββββ | Better quality |
Medium | ~769 MB | β‘β‘ | βββββ | High accuracy |
Large | ~1550 MB | β‘ | βββββ | Best quality |
The server runs on http://localhost:5000
by default. To change this, modify server.py
:
app.run(host='localhost', port=5000, debug=False)
The extension is configured to connect to localhost:5000
. To change the server URL, modify the serverUrl
in Extension/popup.js
:
const serverUrl = 'http://localhost:5000';
POST /generate-subtitles
Request Body:
{
"url": "https://www.youtube.com/watch?v=VIDEO_ID",
"model_size": "base"
}
Response:
{
"success": true,
"srt_content": "1\n00:00:00,000 --> 00:00:05,000\nHello, welcome to this video...\n\n",
"video_title": "Sample Video Title",
"subtitle_count": 42
}
GET /health
Response:
{
"status": "healthy",
"message": "Subtitle generator server is running"
}
-
"Server not responding" error
- Ensure the Python server is running on port 5000
- Check if another application is using port 5000
- Verify firewall settings
-
"Failed to download audio" error
- Check internet connection
- Verify the YouTube URL is valid and accessible
- Some videos may be restricted or private
-
Slow processing
- Use a smaller model size (tiny/base)
- Ensure adequate RAM (4GB+ recommended)
- Close unnecessary applications
-
Extension not working
- Refresh the YouTube page
- Reload the extension in Chrome
- Check browser console for errors
- Use SSD storage for faster model loading
- Close unnecessary tabs to free up memory
- Use base model for best speed/accuracy balance
- Ensure stable internet for smooth downloads
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a 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 for the Whisper model
- pytube developers for YouTube download capabilities
- Flask team for the excellent web framework
- Chrome Extension community for documentation and examples
If you encounter any issues or have questions:
- Check the Troubleshooting section
- Search existing GitHub Issues
- Create a new issue with detailed information
- Include error messages and system information
- Multiple language output support
- Batch processing for multiple videos
- Subtitle editing interface
- Auto-sync with video timing
- Cloud deployment option
- Firefox extension support
Made with β€οΈ by RajM012
Transform any YouTube video into accessible content with AI-powered subtitles!