overcrash66/video-translator

Transform any video into a professional multilingual production with natural voice cloning, lip-sync, and on-screen text translation. No cloud APIs, no subscriptions, no data leaving your machine.

Python

44

221 commits

updated Jul 16, 2026

See the code

README

Project Logo

๐ŸŒ AI Video Translator (Local)

Break language barriers with cinema-quality video translation โ€” privately, on your own hardware.

Transform any video into a professional multilingual production with natural voice cloning, lip-sync, and on-screen text translation. No cloud APIs, no subscriptions, no data leaving your machine.

๐Ÿ“ Enjoying the project? Please star it โญ๏ธ! It helps me gauge interest and keep working on new features.


๐ŸŽฌ Demo

Watch the Demo

๐ŸŽฅ Click the image above to watch the full demo on YouTube!


โœจ Why This Project?

Traditional dubbing is expensive, time-consuming, and requires professional studios. AI Video Translator democratizes video localization by bringing Hollywood-grade technology to your desktop:

  • ๐ŸŽฌ Content Creators: Expand your audience globally without hiring voice actors
  • ๐ŸŽ“ Educators: Make training content accessible in any language
  • ๐Ÿ“ฐ Journalists & Documentarians: Localize footage for international audiences
  • ๐ŸŽฎ Game Developers: Dub cutscenes and trailers cost-effectively
  • ๐Ÿข Businesses: Translate corporate videos, presentations, and webinars
  • ๐Ÿ”’ Privacy-Focused Users: Keep sensitive content 100% local

๐ŸŽฏ What It Does

Upload a video, select your target language, and let the AI handle everything:

๐Ÿ“น Input Video (English) โ†’ ๐Ÿค– AI Pipeline โ†’ ๐Ÿ“น Output Video (French, with cloned voice & synced lips)

The full pipeline includes:

  1. Vocal Separation โ€” Isolates speech from music/sound effects
  2. Transcription โ€” Converts speech to text with word-level precision
  3. Translation โ€” Translates text using local LLMs or Google Translate
  4. Voice Cloning โ€” Regenerates speech in the target language with the original speaker's voice
  5. Lip-Sync โ€” Adjusts mouth movements to match the new audio
  6. Visual Text Translation โ€” Detects and replaces on-screen text (subtitles, signs, etc.)
  7. Audio Enhancement โ€” Cleans and restores generated speech for broadcast quality

๐Ÿš€ Key Features

Audio Intelligence

FeatureTechnologyDescription
Vocal SeparationHDemucs (Meta)Cleanly separates speech from background music/sfx with GPU chunking for long videos
TranscriptionFaster-Whisper (Large v3 Turbo)30-50% faster with Silero VAD preprocessing and word-level confidence filtering
Speaker DiarizationNeMo MSDD / SpeechBrainIdentifies individual speakers for multi-voice dubbing
EQ Spectral MatchingCustomApplies original voice tonal characteristics to TTS output
Voice EnhancementVoiceFixerRestores degraded speech and removes noise (optional)

Translation Engine

ModelTypeBest For
Google TranslateOnlineFast, reliable everyday translation
Tencent HY-MT1.5Local (1.8B)Better context preservation
Llama 3.1 8B InstructLocalNuanced, human-like translations
ALMA-R 7BLocalState-of-the-art translation quality

All local models support context-aware mode using full-transcript context for superior coherence.

Voice Synthesis (TTS)

ModelTypeHighlights
Edge-TTSOnlineNatural Microsoft voices, zero GPU needed
Piper TTSLocalRobust offline neural TTS (auto-downloaded)
XTTS-v2LocalHigh-fidelity voice cloning with emotion control (Happy, Sad, Angry)
F5-TTSLocalUltra-fast zero-shot voice cloning with Sway Sampling
VibeVoiceLocalMicrosoft's frontier long-form multi-speaker TTS (1.5B/7B)

Visual Enhancements

FeatureTechnologyDescription
Lip-Sync (Fast)Wav2Lip-GANSmooth, blended lip synchronization
Lip-Sync (HD)Wav2Lip + GFPGANFace restoration eliminates blurriness
Lip-Sync (Cinema)LivePortraitState-of-the-art cinematic lip sync with natural facial animation
Visual Text TranslationPaddleOCR / EasyOCRDetects and replaces on-screen text with OpenCV inpainting

๐ŸŒ Supported Languages

Video Translator supports a wide range of languages for both source and target translation.

LanguageCode
Auto Detectauto
Englishen
Spanishes
Frenchfr
Germande
Italianit
Portuguesept
Polishpl
Turkishtr
Russianru
Dutchnl
Czechcs
Arabicar
Chinese (Simplified)zh
Japaneseja
Koreanko
Hindihi

Production-Ready

  • ๐Ÿ–ฅ๏ธ Friendly Gradio UI โ€” Easy drag-and-drop interface
  • ๐ŸŽ›๏ธ Fine-Grained Control โ€” Beam size, VAD settings, voice selection, and more
  • ๐Ÿ‘ค LivePortrait Lip-Sync โ€” State-of-the-art lip synchronizer with TensorRT acceleration support
  • ๐Ÿ–ผ๏ธ Visual Text Translation โ€” Detects, translates, and seamlessly replaces text in video frames (cached for speed)
  • ๐Ÿ“ Auto-Generated Subtitles โ€” Exports .srt files alongside translated videos
  • ๐Ÿ”„ Smart Segment Merging โ€” Combines choppy phrases into natural sentences
  • โณ Real-time Progress & ETA โ€” Track detailed progress with estimated time remaining
  • ๐Ÿงน VoiceFixer Enhancement โ€” Restores and cleans up generated audio for studio quality
  • โšก GPU Optimized โ€” One-model-at-a-time policy for maximum VRAM efficiency
  • ๐Ÿ›ก๏ธ Global CPU Fallback โ€” Automatically switches to CPU if GPU fails

๐ŸŽฌ Use Cases

๐ŸŽฅ YouTube & Social Media Creators

"I have 50 English tutorials and want to reach Spanish speakers."

Upload each video, select English โ†’ Spanish, and export professional dubs with your cloned voice. No re-recording needed!

๐ŸŽ“ Corporate Training & E-Learning

"Our compliance training is in English but we have offices in 12 countries."

Batch-translate training videos while maintaining the presenter's voice for authenticity. Export with or without subtitles.

๐ŸŽž๏ธ Film & Documentary Localization

"I want my indie film to premiere at international festivals."

Use LivePortrait (HD) lip-sync for cinema-quality dubbing that doesn't look like a bad overdub.

LivePortrait GPU Acceleration

๐Ÿ“ข Marketing & Advertising

"We need our 30-second ad in French, German, and Japanese by tomorrow."

Process multiple language versions simultaneously with local LLM translation for brand-appropriate messaging.

๐Ÿ” Sensitive Content Translation

"Our video contains confidential product demos."

Everything runs locally โ€” no data leaves your machine. Perfect for legal teams, medical content, or proprietary information.


๐Ÿ› ๏ธ Prerequisites

RequirementDetails
Python3.10+ (3.10 recommended)
PyTorch2.5.1+ with CUDA 12.4+
GPUNVIDIA GPU recommended (RTX 30/40/50 series supported)
VRAM8GB minimum, 12GB+ recommended for HD lip-sync
FFmpegMust be in system PATH
RubberbandRecommended for high-quality audio time-stretching
๐Ÿ“ฅ FFmpeg Installation

Windows (Option 1):

winget install ffmpeg
# Restart terminal after installation

Windows (Option 2 - Manual):

  1. Download from ffmpeg.org/download (Windows builds โ†’ gyan.dev)
  2. Extract to C:\ffmpeg
  3. Add C:\ffmpeg\bin to your system PATH
  4. Restart terminal and verify: ffmpeg -version

Linux:

sudo apt install ffmpeg

macOS:

brew install ffmpeg
๐Ÿ“ฅ Rubberband Installation

Download from Rubberband Releases. Extract and add to PATH, or place rubberband-program.exe in the project folder.


๐Ÿ“ฆ Installation

The smart installer auto-detects your platform, GPU, and CUDA version:

# Clone the repository
git clone https://github.com/overcrash66/video-translator.git
cd video-translator

# Windows:
scripts\install.bat

# Linux / macOS:
chmod +x scripts/install.sh
./scripts/install.sh

๐Ÿ”ง Manual Install

Windows (CUDA 12.8 โ€” RTX 30/40/50 series)
py -3.10 -m venv venv
.\venv\Scripts\activate
pip install -r requirements.txt
Linux (CUDA 12.4)
python3.10 -m venv venv
source venv/bin/activate
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
pip install -r deploy/docker/requirements.docker.txt
macOS (Apple Silicon โ€” CPU only)
python3.10 -m venv venv
source venv/bin/activate
pip install torch torchvision torchaudio
pip install -r requirements.txt

[!NOTE] Some GPU-accelerated features have reduced performance on Apple Silicon. Platform-specific package substitutions (paddlepaddle for paddlepaddle-gpu, onnxruntime for onnxruntime-gpu) are handled automatically by platform markers in the requirements files.

Advanced: Using pyproject.toml extras
# Full install with CUDA 12.4 (default):
pip install -e ".[all]"

# Full install with CUDA 12.8 (RTX 50 series):
pip install -e ".[all-cu128]" --extra-index-url https://download.pytorch.org/whl/cu128

# CPU only:
pip install -e ".[all-cpu]"

# Minimal (core + dev tools only):
pip install -e ".[dev]"

# Selective install (pick what you need):
pip install -e ".[tts,ocr,lipsync]"

โœ… Verify Installation

# Run smoke tests to validate your install
pytest tests/test_smoke_install.py -m smoke -v

# Or use the installer's verify mode
python scripts/install.py --verify

Optional Components

FeatureRequirement
NeMo Diarizationnemo_toolkit[asr]
Wav2LipModel file at models/wav2lip/wav2lip_gan.pth
F5-TTSf5-tts package (GPU recommended)
Enhanced Lip-Syncgfpgan and basicsr (included in requirements)
LivePortrait~2GB VRAM, auto-downloads to models/live_portrait
Llama 3.1 / NeMoHuggingFace token (HF_TOKEN env variable)
VoiceFixerpip install voicefixer>=0.1.2 (may need pip < 24.1)

๐Ÿณ Docker Deployment (GPU)

You can run the application in a Docker container with NVIDIA GPU support.

Prerequisites:

  • NVIDIA Driver (compatible with CUDA 12.x)
  • Docker Desktop (Windows) or Docker Engine (Linux)
  • NVIDIA Container Toolkit (for GPU access inside Docker)
  1. Build the image (run from the project root):

    docker build -f deploy/docker/Dockerfile -t video-translator .
    
  2. Run the container:

    # For PowerShell:
    docker run --gpus all -p 7860:7860 -v ${PWD}/output:/app/output --name video-translator video-translator
    
    # For Command Prompt (CMD):
    docker run --gpus all -p 7860:7860 -v %cd%/output:/app/output --name video-translator video-translator
    

    Note: If you encounter a "Ports are not available" error (common on Windows with Hyper-V), try mapping to a different port like 7950:

    docker run --gpus all -p 7950:7860 -v ${PWD}/output:/app/output --name video-translator video-translator
    
  3. Access the App: Open your browser to http://localhost:7860 (or http://localhost:7950 if you used the alternate port).

๐Ÿ”ง Troubleshooting

"Ports are not available" / "Access is denied" On Windows, Hyper-V or WinNAT often reserves large ranges of ports (including 7860).

  • Solution: Use a different host port (like 7950 or 8080) as shown in the note above.
  • Check reserved ranges: Run netsh interface ipv4 show excludedportrange protocol=tcp to see which ports are blocked.

๐Ÿ–ฅ๏ธ Usage

Quick Start

# Activate environment
.\venv\Scripts\activate

# Launch the application
python app.py

Open your browser to http://127.0.0.1:7860

Step-by-Step Translation

  1. Upload Video โ€” Drag & drop MP4, MKV, or MOV files
  2. Select Languages โ€” Source (or Auto-detect) โ†’ Target
  3. Choose Models:
    • Translation: Google (fast) / Llama 3.1 (quality) / ALMA-R (best)
    • TTS: Edge (online) / F5-TTS (fast cloning) / XTTS (emotion control)
  4. Enable Features (optional):
    • โœ… Speaker Diarization โ€” Multi-speaker videos
    • โœ… Lip-Sync โ€” Select quality level (Fast/HD/Cinema)
    • โœ… Visual Text Translation โ€” Replace on-screen text
    • โœ… Audio Enhancement โ€” VoiceFixer post-processing
  5. Click "Process Video" and monitor progress

โš™๏ธ Configuration

Directory Structure

video-translator/
โ”œโ”€โ”€ temp/           # Intermediate files (auto-cleaned)
โ”œโ”€โ”€ output/         # Final translated videos
โ”œโ”€โ”€ models/         # Downloaded model weights
โ””โ”€โ”€ .env            # Environment variables (HF_TOKEN, etc.)

Environment Variables

HF_TOKEN=your_huggingface_token  # Required for Llama 3.1, NeMo

๐Ÿงฉ Pipeline Architecture

flowchart TD
    Video[Input Video] --> Extract[Extract Audio via FFmpeg]
    Extract --> Separator{"Audio Separator<br/>(HDemucs)"}
    
    Separator -->|Vocals| Vocals[Vocal Track]
    Separator -->|Accompaniment| Background[Background Track]
    
    Vocals --> VAD{"VAD Preprocessing<br/>(Silero VAD)"}
    VAD --> Transcribe{"Transcribe<br/>(Faster-Whisper Turbo)"}
    Transcribe --> Segments[Text Segments]
    Segments --> Merge{Smart Segment Merging}
    
    Vocals -.-> Diarize{"Diarize<br/>(NeMo / SpeechBrain)"}
    Diarize -.-> SpeakerProfiling[Speaker Profiling]
    
    Merge --> Translate{"Translate<br/>(Llama 3.1 / ALMA / HY-MT)"}
    Translate --> SRT[Export .SRT Subtitles]
    
    Translate --> TTS{"Neural TTS<br/>(F5-TTS / XTTS / Edge)"}
    SpeakerProfiling -.-> TTS
    TTS --> TTSAudio[Generated Speech Clips]
    
    TTSAudio --> EQ{EQ Spectral Matching}
    EQ --> Sync{"Synchronize<br/>(PyRubberband)"}
    Sync --> MergedSpeech[Merged Speech Track]
    
    MergedSpeech -.-> VoiceFixer{"Voice Enhancement<br/>(VoiceFixer)"}
    VoiceFixer -.-> Mix
    MergedSpeech --> Mix{Mix Audio}
    Background --> Mix
    
    Mix --> FinalAudio[Final Audio Track]
    
    Video --> VisualTrans{"Visual Translation<br/>(PaddleOCR / EasyOCR)"}
    VisualTrans --> LipSync{"Lip-Sync<br/>(LivePortrait / Wav2Lip / GFPGAN)"}
    MergedSpeech -.-> LipSync
    
    LipSync --> Mux{"Merge with Video<br/>(FFmpeg)"}
    FinalAudio --> Mux
    
    Mux --> Output[Translated Output Video]

๐Ÿค Contributing

Contributions are welcome! Areas where help is appreciated:

  • Additional language support and voice models
  • Performance optimizations
  • Bug fixes and stability improvements
  • Documentation and tutorials

๐Ÿท๏ธ Citation

If you find this project useful, please cite it as follows:

@software{video_translator,
  author = {Wael Sahli},
  email = {[email protected]},
  title = {AI Video Translator},
  url = {https://github.com/overcrash66/video-translator},
  version = {1.0.0},
  date = {2026-06-15}
}

๐Ÿ“„ License

This project is for educational and personal use. Please respect the licenses of underlying models and technologies.


๐ŸŒŸ Star this repo if you find it useful! ๐ŸŒŸ

Made with โค๏ธ for content creators worldwide

audio-processing
lipsync
multilingual
ocr-recognition
python3
s2tt
translation-tool
tts-model
video-editing
video-generation
video-translation

overcrash66/video-translator

Transform any video into a professional multilingual production with natural voice cloning, lip-sync, and on-screen text translation. No cloud APIs, no subscriptions, no data leaving your machine.

Python

44

221 commits

updated Jul 16, 2026

See the code

README

Project Logo

๐ŸŒ AI Video Translator (Local)

Break language barriers with cinema-quality video translation โ€” privately, on your own hardware.

Transform any video into a professional multilingual production with natural voice cloning, lip-sync, and on-screen text translation. No cloud APIs, no subscriptions, no data leaving your machine.

๐Ÿ“ Enjoying the project? Please star it โญ๏ธ! It helps me gauge interest and keep working on new features.


๐ŸŽฌ Demo

Watch the Demo

๐ŸŽฅ Click the image above to watch the full demo on YouTube!


โœจ Why This Project?

Traditional dubbing is expensive, time-consuming, and requires professional studios. AI Video Translator democratizes video localization by bringing Hollywood-grade technology to your desktop:

  • ๐ŸŽฌ Content Creators: Expand your audience globally without hiring voice actors
  • ๐ŸŽ“ Educators: Make training content accessible in any language
  • ๐Ÿ“ฐ Journalists & Documentarians: Localize footage for international audiences
  • ๐ŸŽฎ Game Developers: Dub cutscenes and trailers cost-effectively
  • ๐Ÿข Businesses: Translate corporate videos, presentations, and webinars
  • ๐Ÿ”’ Privacy-Focused Users: Keep sensitive content 100% local

๐ŸŽฏ What It Does

Upload a video, select your target language, and let the AI handle everything:

๐Ÿ“น Input Video (English) โ†’ ๐Ÿค– AI Pipeline โ†’ ๐Ÿ“น Output Video (French, with cloned voice & synced lips)

The full pipeline includes:

  1. Vocal Separation โ€” Isolates speech from music/sound effects
  2. Transcription โ€” Converts speech to text with word-level precision
  3. Translation โ€” Translates text using local LLMs or Google Translate
  4. Voice Cloning โ€” Regenerates speech in the target language with the original speaker's voice
  5. Lip-Sync โ€” Adjusts mouth movements to match the new audio
  6. Visual Text Translation โ€” Detects and replaces on-screen text (subtitles, signs, etc.)
  7. Audio Enhancement โ€” Cleans and restores generated speech for broadcast quality

๐Ÿš€ Key Features

Audio Intelligence

FeatureTechnologyDescription
Vocal SeparationHDemucs (Meta)Cleanly separates speech from background music/sfx with GPU chunking for long videos
TranscriptionFaster-Whisper (Large v3 Turbo)30-50% faster with Silero VAD preprocessing and word-level confidence filtering
Speaker DiarizationNeMo MSDD / SpeechBrainIdentifies individual speakers for multi-voice dubbing
EQ Spectral MatchingCustomApplies original voice tonal characteristics to TTS output
Voice EnhancementVoiceFixerRestores degraded speech and removes noise (optional)

Translation Engine

ModelTypeBest For
Google TranslateOnlineFast, reliable everyday translation
Tencent HY-MT1.5Local (1.8B)Better context preservation
Llama 3.1 8B InstructLocalNuanced, human-like translations
ALMA-R 7BLocalState-of-the-art translation quality

All local models support context-aware mode using full-transcript context for superior coherence.

Voice Synthesis (TTS)

ModelTypeHighlights
Edge-TTSOnlineNatural Microsoft voices, zero GPU needed
Piper TTSLocalRobust offline neural TTS (auto-downloaded)
XTTS-v2LocalHigh-fidelity voice cloning with emotion control (Happy, Sad, Angry)
F5-TTSLocalUltra-fast zero-shot voice cloning with Sway Sampling
VibeVoiceLocalMicrosoft's frontier long-form multi-speaker TTS (1.5B/7B)

Visual Enhancements

FeatureTechnologyDescription
Lip-Sync (Fast)Wav2Lip-GANSmooth, blended lip synchronization
Lip-Sync (HD)Wav2Lip + GFPGANFace restoration eliminates blurriness
Lip-Sync (Cinema)LivePortraitState-of-the-art cinematic lip sync with natural facial animation
Visual Text TranslationPaddleOCR / EasyOCRDetects and replaces on-screen text with OpenCV inpainting

๐ŸŒ Supported Languages

Video Translator supports a wide range of languages for both source and target translation.

LanguageCode
Auto Detectauto
Englishen
Spanishes
Frenchfr
Germande
Italianit
Portuguesept
Polishpl
Turkishtr
Russianru
Dutchnl
Czechcs
Arabicar
Chinese (Simplified)zh
Japaneseja
Koreanko
Hindihi

Production-Ready

  • ๐Ÿ–ฅ๏ธ Friendly Gradio UI โ€” Easy drag-and-drop interface
  • ๐ŸŽ›๏ธ Fine-Grained Control โ€” Beam size, VAD settings, voice selection, and more
  • ๐Ÿ‘ค LivePortrait Lip-Sync โ€” State-of-the-art lip synchronizer with TensorRT acceleration support
  • ๐Ÿ–ผ๏ธ Visual Text Translation โ€” Detects, translates, and seamlessly replaces text in video frames (cached for speed)
  • ๐Ÿ“ Auto-Generated Subtitles โ€” Exports .srt files alongside translated videos
  • ๐Ÿ”„ Smart Segment Merging โ€” Combines choppy phrases into natural sentences
  • โณ Real-time Progress & ETA โ€” Track detailed progress with estimated time remaining
  • ๐Ÿงน VoiceFixer Enhancement โ€” Restores and cleans up generated audio for studio quality
  • โšก GPU Optimized โ€” One-model-at-a-time policy for maximum VRAM efficiency
  • ๐Ÿ›ก๏ธ Global CPU Fallback โ€” Automatically switches to CPU if GPU fails

๐ŸŽฌ Use Cases

๐ŸŽฅ YouTube & Social Media Creators

"I have 50 English tutorials and want to reach Spanish speakers."

Upload each video, select English โ†’ Spanish, and export professional dubs with your cloned voice. No re-recording needed!

๐ŸŽ“ Corporate Training & E-Learning

"Our compliance training is in English but we have offices in 12 countries."

Batch-translate training videos while maintaining the presenter's voice for authenticity. Export with or without subtitles.

๐ŸŽž๏ธ Film & Documentary Localization

"I want my indie film to premiere at international festivals."

Use LivePortrait (HD) lip-sync for cinema-quality dubbing that doesn't look like a bad overdub.

LivePortrait GPU Acceleration

๐Ÿ“ข Marketing & Advertising

"We need our 30-second ad in French, German, and Japanese by tomorrow."

Process multiple language versions simultaneously with local LLM translation for brand-appropriate messaging.

๐Ÿ” Sensitive Content Translation

"Our video contains confidential product demos."

Everything runs locally โ€” no data leaves your machine. Perfect for legal teams, medical content, or proprietary information.


๐Ÿ› ๏ธ Prerequisites

RequirementDetails
Python3.10+ (3.10 recommended)
PyTorch2.5.1+ with CUDA 12.4+
GPUNVIDIA GPU recommended (RTX 30/40/50 series supported)
VRAM8GB minimum, 12GB+ recommended for HD lip-sync
FFmpegMust be in system PATH
RubberbandRecommended for high-quality audio time-stretching
๐Ÿ“ฅ FFmpeg Installation

Windows (Option 1):

winget install ffmpeg
# Restart terminal after installation

Windows (Option 2 - Manual):

  1. Download from ffmpeg.org/download (Windows builds โ†’ gyan.dev)
  2. Extract to C:\ffmpeg
  3. Add C:\ffmpeg\bin to your system PATH
  4. Restart terminal and verify: ffmpeg -version

Linux:

sudo apt install ffmpeg

macOS:

brew install ffmpeg
๐Ÿ“ฅ Rubberband Installation

Download from Rubberband Releases. Extract and add to PATH, or place rubberband-program.exe in the project folder.


๐Ÿ“ฆ Installation

The smart installer auto-detects your platform, GPU, and CUDA version:

# Clone the repository
git clone https://github.com/overcrash66/video-translator.git
cd video-translator

# Windows:
scripts\install.bat

# Linux / macOS:
chmod +x scripts/install.sh
./scripts/install.sh

๐Ÿ”ง Manual Install

Windows (CUDA 12.8 โ€” RTX 30/40/50 series)
py -3.10 -m venv venv
.\venv\Scripts\activate
pip install -r requirements.txt
Linux (CUDA 12.4)
python3.10 -m venv venv
source venv/bin/activate
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
pip install -r deploy/docker/requirements.docker.txt
macOS (Apple Silicon โ€” CPU only)
python3.10 -m venv venv
source venv/bin/activate
pip install torch torchvision torchaudio
pip install -r requirements.txt

[!NOTE] Some GPU-accelerated features have reduced performance on Apple Silicon. Platform-specific package substitutions (paddlepaddle for paddlepaddle-gpu, onnxruntime for onnxruntime-gpu) are handled automatically by platform markers in the requirements files.

Advanced: Using pyproject.toml extras
# Full install with CUDA 12.4 (default):
pip install -e ".[all]"

# Full install with CUDA 12.8 (RTX 50 series):
pip install -e ".[all-cu128]" --extra-index-url https://download.pytorch.org/whl/cu128

# CPU only:
pip install -e ".[all-cpu]"

# Minimal (core + dev tools only):
pip install -e ".[dev]"

# Selective install (pick what you need):
pip install -e ".[tts,ocr,lipsync]"

โœ… Verify Installation

# Run smoke tests to validate your install
pytest tests/test_smoke_install.py -m smoke -v

# Or use the installer's verify mode
python scripts/install.py --verify

Optional Components

FeatureRequirement
NeMo Diarizationnemo_toolkit[asr]
Wav2LipModel file at models/wav2lip/wav2lip_gan.pth
F5-TTSf5-tts package (GPU recommended)
Enhanced Lip-Syncgfpgan and basicsr (included in requirements)
LivePortrait~2GB VRAM, auto-downloads to models/live_portrait
Llama 3.1 / NeMoHuggingFace token (HF_TOKEN env variable)
VoiceFixerpip install voicefixer>=0.1.2 (may need pip < 24.1)

๐Ÿณ Docker Deployment (GPU)

You can run the application in a Docker container with NVIDIA GPU support.

Prerequisites:

  • NVIDIA Driver (compatible with CUDA 12.x)
  • Docker Desktop (Windows) or Docker Engine (Linux)
  • NVIDIA Container Toolkit (for GPU access inside Docker)
  1. Build the image (run from the project root):

    docker build -f deploy/docker/Dockerfile -t video-translator .
    
  2. Run the container:

    # For PowerShell:
    docker run --gpus all -p 7860:7860 -v ${PWD}/output:/app/output --name video-translator video-translator
    
    # For Command Prompt (CMD):
    docker run --gpus all -p 7860:7860 -v %cd%/output:/app/output --name video-translator video-translator
    

    Note: If you encounter a "Ports are not available" error (common on Windows with Hyper-V), try mapping to a different port like 7950:

    docker run --gpus all -p 7950:7860 -v ${PWD}/output:/app/output --name video-translator video-translator
    
  3. Access the App: Open your browser to http://localhost:7860 (or http://localhost:7950 if you used the alternate port).

๐Ÿ”ง Troubleshooting

"Ports are not available" / "Access is denied" On Windows, Hyper-V or WinNAT often reserves large ranges of ports (including 7860).

  • Solution: Use a different host port (like 7950 or 8080) as shown in the note above.
  • Check reserved ranges: Run netsh interface ipv4 show excludedportrange protocol=tcp to see which ports are blocked.

๐Ÿ–ฅ๏ธ Usage

Quick Start

# Activate environment
.\venv\Scripts\activate

# Launch the application
python app.py

Open your browser to http://127.0.0.1:7860

Step-by-Step Translation

  1. Upload Video โ€” Drag & drop MP4, MKV, or MOV files
  2. Select Languages โ€” Source (or Auto-detect) โ†’ Target
  3. Choose Models:
    • Translation: Google (fast) / Llama 3.1 (quality) / ALMA-R (best)
    • TTS: Edge (online) / F5-TTS (fast cloning) / XTTS (emotion control)
  4. Enable Features (optional):
    • โœ… Speaker Diarization โ€” Multi-speaker videos
    • โœ… Lip-Sync โ€” Select quality level (Fast/HD/Cinema)
    • โœ… Visual Text Translation โ€” Replace on-screen text
    • โœ… Audio Enhancement โ€” VoiceFixer post-processing
  5. Click "Process Video" and monitor progress

โš™๏ธ Configuration

Directory Structure

video-translator/
โ”œโ”€โ”€ temp/           # Intermediate files (auto-cleaned)
โ”œโ”€โ”€ output/         # Final translated videos
โ”œโ”€โ”€ models/         # Downloaded model weights
โ””โ”€โ”€ .env            # Environment variables (HF_TOKEN, etc.)

Environment Variables

HF_TOKEN=your_huggingface_token  # Required for Llama 3.1, NeMo

๐Ÿงฉ Pipeline Architecture

flowchart TD
    Video[Input Video] --> Extract[Extract Audio via FFmpeg]
    Extract --> Separator{"Audio Separator<br/>(HDemucs)"}
    
    Separator -->|Vocals| Vocals[Vocal Track]
    Separator -->|Accompaniment| Background[Background Track]
    
    Vocals --> VAD{"VAD Preprocessing<br/>(Silero VAD)"}
    VAD --> Transcribe{"Transcribe<br/>(Faster-Whisper Turbo)"}
    Transcribe --> Segments[Text Segments]
    Segments --> Merge{Smart Segment Merging}
    
    Vocals -.-> Diarize{"Diarize<br/>(NeMo / SpeechBrain)"}
    Diarize -.-> SpeakerProfiling[Speaker Profiling]
    
    Merge --> Translate{"Translate<br/>(Llama 3.1 / ALMA / HY-MT)"}
    Translate --> SRT[Export .SRT Subtitles]
    
    Translate --> TTS{"Neural TTS<br/>(F5-TTS / XTTS / Edge)"}
    SpeakerProfiling -.-> TTS
    TTS --> TTSAudio[Generated Speech Clips]
    
    TTSAudio --> EQ{EQ Spectral Matching}
    EQ --> Sync{"Synchronize<br/>(PyRubberband)"}
    Sync --> MergedSpeech[Merged Speech Track]
    
    MergedSpeech -.-> VoiceFixer{"Voice Enhancement<br/>(VoiceFixer)"}
    VoiceFixer -.-> Mix
    MergedSpeech --> Mix{Mix Audio}
    Background --> Mix
    
    Mix --> FinalAudio[Final Audio Track]
    
    Video --> VisualTrans{"Visual Translation<br/>(PaddleOCR / EasyOCR)"}
    VisualTrans --> LipSync{"Lip-Sync<br/>(LivePortrait / Wav2Lip / GFPGAN)"}
    MergedSpeech -.-> LipSync
    
    LipSync --> Mux{"Merge with Video<br/>(FFmpeg)"}
    FinalAudio --> Mux
    
    Mux --> Output[Translated Output Video]

๐Ÿค Contributing

Contributions are welcome! Areas where help is appreciated:

  • Additional language support and voice models
  • Performance optimizations
  • Bug fixes and stability improvements
  • Documentation and tutorials

๐Ÿท๏ธ Citation

If you find this project useful, please cite it as follows:

@software{video_translator,
  author = {Wael Sahli},
  email = {[email protected]},
  title = {AI Video Translator},
  url = {https://github.com/overcrash66/video-translator},
  version = {1.0.0},
  date = {2026-06-15}
}

๐Ÿ“„ License

This project is for educational and personal use. Please respect the licenses of underlying models and technologies.


๐ŸŒŸ Star this repo if you find it useful! ๐ŸŒŸ

Made with โค๏ธ for content creators worldwide

audio-processing
lipsync
multilingual
ocr-recognition
python3
s2tt
translation-tool
tts-model
video-editing
video-generation
video-translation