A production-ready web application for transcribing videos using AI-powered speech recognition with Google Gemini or OpenAI Whisper APIs.
- π€ User Authentication: Secure signup/login with email OTP verification
- π Multi-User Support: Isolated user data with encrypted API key storage
- π¬ Video Upload & Transcription: Support for multiple formats (MP4, AVI, MOV, etc.)
- π£οΈ Speaker Diarization: AI-powered speaker detection and labeling
- β¨ Content Enhancement: Automatic filler word removal and profanity filtering
- π Encrypted API Keys: Fernet encryption for secure API key storage
- π§ Email Verification: OTP-based email verification system
- β‘ Real-time Updates: WebSocket-based live transcription progress
- π Transcription History: Complete history with search and management
- π‘οΈ Security Features: Rate limiting, XSS protection, CSRF prevention
- π³ Docker Ready: Complete containerization with Docker Compose
- πΎ PostgreSQL Database: Production-grade database with Redis caching
- Docker & Docker Compose
- Git
- Python 3.13 or higher
- PostgreSQL 15+
- Redis 7+
- FFmpeg (for audio extraction)
The easiest way to run the application is using Docker Compose:
- Clone the repository:
git clone git@github.com:orendrasingh/video-transcription.git
cd video-transcription- Configure environment variables:
cp .env.example .env
# Edit .env with your settings (SMTP credentials, secret key, etc.)- Start all services:
docker-compose up --build- Access the application:
http://localhost:5001
That's it! PostgreSQL, Redis, and the Flask app are all running in containers.
# Start services in background
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down
# Rebuild after code changes
docker-compose up --build
# View running containers
docker-compose psmacOS:
brew install ffmpeg postgresql redisUbuntu/Debian:
sudo apt update
sudo apt install ffmpeg postgresql redis-server libpq-dev# Start PostgreSQL
sudo systemctl start postgresql # Linux
brew services start postgresql # macOS
# Create database and user
psql postgres
CREATE DATABASE transcription_db;
CREATE USER transcription_user WITH PASSWORD 'your_password';
GRANT ALL PRIVILEGES ON DATABASE transcription_db TO transcription_user;
\q# Start Redis
sudo systemctl start redis # Linux
brew services start redis # macOS# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtcp .env.example .env
# Edit .env with your database credentials and SMTP settingspython app.pyOpen browser to http://localhost:5001
Create a .env file with the following:
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/transcription_db
# Redis
REDIS_URL=redis://localhost:6379/0
# Flask
SECRET_KEY=your-secret-key-here
FLASK_ENV=development
# Email (SMTP)
MAIL_SERVER=smtp.gmail.com
MAIL_PORT=587
MAIL_USE_TLS=True
MAIL_USERNAME=your-email@gmail.com
MAIL_PASSWORD=your-app-password
# Encryption (generate with: python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())")
ENCRYPTION_KEY=your-fernet-key-hereUsers add their own API keys through the web interface:
- Google Gemini: Google AI Studio
- OpenAI: OpenAI Platform
-
Sign Up:
- Enter email, password, and name
- Verify email with OTP sent to your inbox
- Login with verified credentials
-
Add API Keys:
- Navigate to "π API Keys" tab
- Add your Gemini and/or OpenAI API keys
- Keys are encrypted and stored securely
-
Transcribe Videos:
- Go to "π€ Upload" tab
- Select video file (supports MP4, AVI, MOV, MKV, etc.)
- Choose AI provider (Gemini or OpenAI)
- Click "Start Transcription"
- Monitor real-time progress
- Get enhanced transcription with:
- Speaker labels (Speaker 1, Speaker 2, etc.)
- Clean formatting with natural conversation flow
- Filler words removed
- Profanity filtered
-
Manage History:
- View all transcriptions in "π History" tab
- Search and filter results
- Copy or download transcriptions
- Delete old entries
- Backend: Flask 3.0, Flask-SocketIO, Flask-SQLAlchemy
- Database: PostgreSQL 15 with encrypted storage
- Cache/Sessions: Redis 7
- AI APIs: Google Gemini 1.5 Flash, OpenAI Whisper + GPT-4o-mini
- Security: Flask-Limiter, Fernet encryption, Bleach XSS protection
- Email: Flask-Mail with SMTP
- Containerization: Docker & Docker Compose
- Video Processing: FFmpeg
POST /api/auth/signup- Create user accountPOST /api/auth/verify-otp- Verify email with OTPPOST /api/auth/login- Login with credentialsPOST /api/auth/logout- Logout current sessionGET /api/auth/user- Get current user info
GET /api/keys- List encrypted API keysPOST /api/keys- Add/update API keyDELETE /api/keys?provider={provider}- Delete API key
POST /api/transcribe- Start transcription jobGET /api/transcriptions/{id}- Get transcription detailsGET /api/history- Get user's historyDELETE /api/history/{id}- Delete transcription
status_update- Real-time progress updates
video-transcription/
βββ app.py # Main Flask application
βββ models.py # SQLAlchemy database models
βββ transcription_service.py # AI transcription logic
βββ email_service.py # OTP email service
βββ encryption_service.py # API key encryption
βββ requirements.txt # Python dependencies
βββ Dockerfile # Docker image definition
βββ docker-compose.yml # Multi-container orchestration
βββ .env.example # Environment template
βββ .gitignore # Git ignore rules
βββ templates/
β βββ index.html # Single-page application
βββ static/
β βββ style.css # Dark theme styles
β βββ script.js # Frontend logic
βββ uploads/ # Temporary video storage
- Speaker Diarization: Automatically detects and labels different speakers
- Content Filtering: Removes filler words (um, uh, like) and profanity
- Natural Flow: Formats transcriptions with proper paragraphs and punctuation
- Multi-Provider: Choose between Gemini (fast, cost-effective) or OpenAI (highly accurate)
- Video: MP4, AVI, MOV, MKV, WMV, FLV, WebM
- Maximum Size: 500MB per file
- Languages: 99+ languages supported
- Email Verification: OTP-based email verification for new accounts
- Encrypted Storage: Fernet encryption for API keys at rest
- Password Hashing: Werkzeug security for password storage
- Rate Limiting: Redis-backed rate limiting on all endpoints
- XSS Protection: Bleach sanitization for user inputs
- CSRF Protection: Built-in Flask CSRF protection
- Session Security: Secure cookie-based sessions
- Data Isolation: Users can only access their own data
Port conflicts:
# Check if ports are in use
lsof -i :5001 # App
lsof -i :5432 # PostgreSQL
lsof -i :6379 # Redis
# Change ports in docker-compose.yml if neededDatabase connection errors:
# Restart services
docker-compose down
docker-compose up --buildView container logs:
docker-compose logs app
docker-compose logs postgres
docker-compose logs redisFFmpeg not found:
ffmpeg -version # Verify installationDatabase connection failed:
# Check PostgreSQL is running
sudo systemctl status postgresql # Linux
brew services list # macOS
# Verify credentials in .env match databaseEmail OTP not sending:
- Check SMTP credentials in
.env - For Gmail, use App Password (not regular password)
- Verify
MAIL_USE_TLS=Truefor port 587
API Key errors:
- Verify API keys are valid and have credits
- Check provider status pages
- Ensure proper API permissions
ModuleNotFoundError:
pip install -r requirements.txtPermission denied:
chmod +x uploads/ # Ensure uploads directory is writable-
Update environment variables:
- Set
FLASK_ENV=production - Use strong
SECRET_KEYandENCRYPTION_KEY - Configure production SMTP server
- Set
-
Use production WSGI server:
- Replace development server with Gunicorn
- Add to
requirements.txt:gunicorn - Update Dockerfile CMD:
gunicorn -k gevent -w 1 app:app
-
Enable HTTPS:
- Use nginx reverse proxy
- Configure SSL certificates (Let's Encrypt)
-
Backups:
- Regular PostgreSQL backups
- Volume backup for uploads (if persisted)
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License - free to use for personal or commercial projects.
For issues or questions:
- Open an issue on GitHub
- Check existing issues for solutions