How udayatk/video-translator works
Project type and purpose
• This is a small full-stack Python application built with Streamlit (single “app.py” entry point).
• Purpose: take an English video, extract its audio, transcribe speech to text, translate that text into Indian regional languages, generate synthetic voiceovers in the target language, replace the original audio track, then bundle the dubbed video plus transcripts into a downloadable ZIP.
File structure
• Top-level files
– app.py: contains both the Streamlit UI and the entire backend pipeline.
– requirements.txt: lists Python dependencies (e.g., ffmpeg-wrapper, OpenAI/Whisper, googletrans, gTTS or pyttsx3, moviepy).
– README.md: high-level description.
• .streamlit/config.toml
– Streamlit configuration (server settings, theming, etc.)
Extract key points from the README
• Workflow steps: audio extraction → transcription → translation → voiceover generation → audio replacement → packaging.
• Targets multiple Indian languages (Hindi, Telugu, Tamil, etc.).
• Outputs: dubbed video and original & translated transcripts in ZIP.
Main components
a. Streamlit Web UI
– Components: file uploader, language selector, “Translate” button, progress indicators, download link.
b. Backend Pipeline (Python functions/modules)
1. Video Ingestion & Audio Extraction (ffmpeg)
2. Speech-to-Text Transcription (e.g., OpenAI Whisper or other STT API)
3. Text Translation (googletrans or similar)
4. Text-to-Speech Synthesis (gTTS / pyttsx3)
5. Audio-Video Merging (moviepy or ffmpeg)
6. Packaging & ZIP Creation (built-in zipfile or shutil)
c. Storage / Temporary Files
– Local temp directory or in-memory streams for intermediate audio, text, and final video.
d. Client Download Endpoint (Streamlit file download component)
Relationships & data flow
• TTS to generate audio tracks per target language
• Packaging of original transcript
Architectural patterns & design principles
• Pipeline (staged processing) pattern – each transformation is a distinct module.
• Separation of concerns – UI logic vs. processing logic.
• Stateless, request-driven design – each upload triggers a fresh pipeline run.
• Extensibility point – add or swap out a translation or TTS engine by abstracting that stage.
Technologies & frameworks
• Streamlit: front-end UI server.
• ffmpeg (via subprocess or ffmpeg-python): audio extraction & merging.
• Whisper / other STT API: transcription.
• googletrans / DeepL API: translation.
• gTTS / pyttsx3: TTS.
• moviepy or direct ffmpeg: video editing.
• zipfile (Python stdlib): packaging.