AI-powered subtitle generator and translator with NVIDIA GPU acceleration
1.7K
GPU-accelerated subtitle generation for video files using OpenAI Whisper AI and NLLB translation
Features • Quick Start • Usage • Configuration • Docker Hub
docker run -d --name srtgen \
--gpus all \
-p 5000:5000 \
-v /path/to/media:/media \
-e WHISPER_MODEL=medium \
agoddrie/srtgen:latest
Access: http://localhost:5000
Create docker-compose.yml:
version: '3.8'
services:
srtgen:
image: agoddrie/srtgen:latest
container_name: srtgen
ports:
- "5000:5000"
volumes:
- /mnt/user/TV-Series:/media/tv:rw
- /mnt/user/Movies:/media/movies:rw
environment:
- WHISPER_MODEL=medium
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
restart: unless-stopped
Start:
docker-compose up -d
Install translation dependencies (one-time):
docker exec -it srtgen pip install transformers sentencepiece protobuf sacremoses
https://github.com/agoddrie/srtgenhttp://localhost:5000For movie.mkv, generates:
movie.en.srt # Original language transcription
movie.en.srt # English translation (if not English)
movie.nl.srt # Target language (e.g., Dutch)
.mkv, .mp4, .aviSet via environment variable:
| Model | VRAM | Speed | Accuracy | Recommended |
|---|---|---|---|---|
tiny | ~1GB | Fastest | Good | Testing |
base | ~1GB | Very Fast | Better | Quick jobs |
small | ~2GB | Fast | Good | Balanced |
medium | ~5GB | Moderate | Excellent | ⭐ Production |
large | ~10GB | Slow | Best | Maximum quality |
Example:
environment:
- WHISPER_MODEL=medium
Access via ⚙️ icon in web UI:
volumes:
- /host/path:/media/name:rw # Read-write required for SRT creation
Important: Use :rw flag to allow subtitle file creation
| Component | Technology | Purpose |
|---|---|---|
| AI Transcription | OpenAI Whisper | Speech-to-text with 99+ languages |
| AI Translation | Facebook NLLB-200-1.3B | Context-aware translation (200+ languages) |
| Backend | Python 3.11 + Flask | REST API and job management |
| GPU Acceleration | PyTorch + CUDA | 10x faster processing |
| Audio Processing | FFmpeg | Extract audio from video containers |
| Frontend | Vanilla JavaScript | Lightweight, no dependencies |
| Storage | localStorage | Settings persistence |
graph LR
A[Video File] -->|FFmpeg| B[Audio 16kHz WAV]
B -->|Whisper| C[Original SRT + Language]
C -->|Whisper Translate| D[English SRT]
C -->|NLLB-200| E[Target Language SRT]
D --> F[Triple SRT Output]
E --> F
/tmpdocker exec -it srtgen pip install transformers sentencepiece protobuf sacremoses
Note: Required on first run. Will be added to Dockerfile in future release.
Verify NVIDIA runtime:
docker run --rm --gpus all nvidia/cuda:11.8.0-base-ubuntu22.04 nvidia-smi
Install nvidia-container-toolkit:
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker
Ctrl+Shift+Rdocker restart srtgenEnsure volumes use :rw flag:
volumes:
- /path/to/media:/media:rw # Not :ro
Word-level timestamps enabled by default. If issues persist:
git clone https://github.com/agoddrie/srtgen.git
cd srtgen
docker build -t agoddrie/srtgen:latest .
docker-compose up -d
Contributions welcome! Please:
git checkout -b feature/amazing)git commit -m 'Add amazing feature')git push origin feature/amazing)# Clone repo
git clone https://github.com/agoddrie/srtgen.git
cd srtgen
# Build image
docker build -t srtgen:dev .
# Run with hot-reload
docker run -it --rm \
--gpus all \
-p 5000:5000 \
-v $(pwd)/app.py:/app/app.py \
-v $(pwd)/mkv_transcribe.py:/app/mkv_transcribe.py \
-v /media:/media:rw \
srtgen:dev
Test file: 22-minute episode (The IT Crowd S01E01)
| Model | GPU | Time | Accuracy | VRAM |
|---|---|---|---|---|
| tiny | RTX 5070 Ti | 45s | 85% | 1.2GB |
| base | RTX 5070 Ti | 1m 15s | 92% | 1.5GB |
| small | RTX 5070 Ti | 2m 30s | 96% | 2.8GB |
| medium | RTX 5070 Ti | 4m 20s | 98% | 5.2GB |
| large | RTX 5070 Ti | 8m 45s | 99% | 10.5GB |
Translation adds ~2-3 minutes for NLLB-1.3B processing
MIT License - See LICENSE file
Third-party components:
If you find SRTGEN useful, please:
Made with ❤️ for the Unraid community
Content type
Image
Digest
sha256:df8a96ed0…
Size
4.3 GB
Last updated
10 months ago
docker pull agoddrie/srtgen