How mikk0git/youtube-auto-dubbing works
Project type and purpose
• This is a small command-line tool (“Youtube Auto Dubbing”) that takes a YouTube URL, downloads the video, extracts or uses provided subtitles, translates them into a target language, generates AI voice via TTS, re-syncs audio to match lip movements, and outputs a dubbed video.
File structure
• At the top level you have:
• main.py – the single entry point and orchestrator
• requirements.txt – Python dependencies
• rubberband.exe / rubberband-r3.exe – native audio time-stretching utilities
• README.md, LICENSE, .gitignore – supporting documentation
• No separate frontend/backend—this is a monolithic CLI app
• External dependencies: Python packages, FFmpeg, Rubberband
Key insights from the README
• Usage flags for language, subtitle folder, and “audio only” mode
• Depends on FFmpeg for media handling, uses pure-Python TTS/translation (no cloud APIs)
• Future plans: GUI, add 11Labs voice support
Components & relationships
a. Main Components
1. CLI Parser (main.py)
2. YouTube Downloader (e.g., pytube or yt-dl)
3. Media Extractor (FFmpeg)
4. Subtitle Loader / Parser (built-in or from file)
5. Translator Service (local translation library)
6. TTS Engine (local AI voice generator)
7. Audio Sync Module (Rubberband)
8. Media Merger (FFmpeg)
9. Output Writer (final video/audio file)
10. External Dependencies (FFmpeg, rubberband.exe)
b. Data flows & interactions
• User types “python main.py <URL> -l de” → CLI Parser
• CLI Parser calls YouTube Downloader → raw video + source subtitles
• Media Extractor splits video into audio track and frames/subtitles
• Subtitle Loader reads custom or extracted subtitles
• Translator turns source lines into target‐language lines
• TTS Engine converts translated lines into speech audio clips
• Audio Sync Module (rubberband) adjusts timing/duration of speech to match original pacing
• Media Merger uses FFmpeg to combine original video frames with dubbed audio
• Output Writer saves final dubbed video (or audio only)
c. Architectural patterns & design principles
• Single orchestrator script following a pipeline pattern—each step takes input, transforms it, passes it onward
• Clear separation between download, transform (translate/TTS), sync, and output stages
• External tools (FFmpeg, rubberband) invoked as subprocesses
d. Key technologies / libraries
• Python (main.py)
• FFmpeg (command-line)
• Rubberband (audio time-stretch)
• pytube or youtube-dl (video download)
• translation & TTS Python packages