You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Python pipeline that takes a YouTube URL and spits out a dubbed/subtitled video. Feed it a link, pick a target language, and it handles the rest — downloading, transcribing, translating, synthesizing speech, and rendering the final video.
8
-
9
-
We built this because existing tools were either too manual, too expensive, or too locked-in. This one runs locally, stays free, and gives you full control over the output.
7
+
Translate, subtitle, and dub any YouTube video automatically. Takes a URL and a target language — handles download, transcription, translation, TTS, and final render locally.
├── .cache/ # Downloaded videos (persists between runs)
161
-
├── output/ # Final rendered videos
162
-
└── temp/ # Intermediate files (cleared each run)
143
+
youtube_auto_dub/
144
+
├── __init__.py # Package version
145
+
├── __main__.py # python -m support
146
+
├── cli.py # argparse with global-standard flags
147
+
├── core.py # Pipeline orchestrator (7-step run)
148
+
├── models.py # Dataclasses + all centralized constants
149
+
├── audio.py # Chunking, mixing, tempo align, loudness, render
150
+
├── speech.py # Whisper ASR with VAD & metadata prompt
151
+
├── subs.py # SRT parsing, resplit, refinement
152
+
├── voice.py # Edge TTS + Qwen3-TTS synthesis
153
+
├── googlev4.py # Google Translate (RPC + scrape)
154
+
├── youtube.py # yt-dlp wrapper with metadata
155
+
├── ui.py # Rich console helpers
156
+
└── language_map.json # Language → voice mappings
157
+
tests/
158
+
├── test_models.py # Dataclass tests
159
+
├── test_googlev4.py # Translation logic tests (no network)
160
+
└── test_voice.py # Voice lookup tests
161
+
.github/workflows/
162
+
└── ci.yml # Ruff lint + pytest
163
163
```
164
164
165
165
---
166
166
167
-
## Known issues & workarounds
168
-
169
-
**FFmpeg not found**
170
-
Add FFmpeg to your system PATH. Run `ffmpeg -version` to verify.
167
+
## Known issues
171
168
172
-
**CUDA out of memory**
173
-
Switch to a smaller model: `--whisper_model tiny` or `--whisper_model base`. The pipeline auto-selects `base` on CPU and `small` on GPU if you don't specify.
169
+
**FFmpeg not found** — add FFmpeg to PATH.
174
170
175
-
**Translation splitting wrong**
176
-
The batch translator joins segments with a delimiter and splits on it after. If the translated text collapses the delimiter, it falls back to translating each segment individually. Slower but accurate.
171
+
**CUDA OOM** — use `--model tiny` or `--model base`.
177
172
178
-
**YouTube rate-limited or auth errors**
179
-
Close your browser fully before running with `--browser chrome`. If that still fails, export a `cookies.txt` file via a browser extension and pass it with `yt-dlp`'s `--cookies` option directly (you'd need to patch `youtube.py` for now — PRs welcome).
180
-
181
-
**TTS file too small / silent audio**
182
-
Usually a bad language code or a voice that's region-restricted. Double check your `language_map.json` entry and try the other gender.
173
+
**YouTube auth errors** — close browser fully before `--browser chrome`.
183
174
184
175
---
185
176
186
177
## What we're working on
187
178
188
-
-**Speaker diarization** — using `pyannote.audio` to detect multiple speakers and assign them distinct voices
189
-
-**Background music separation** — `Demucs` integration to preserve BGM while replacing only the vocals
190
-
-**Voice conversion (RVC)** — optional post-processing to match the original speaker's voice characteristics
191
-
192
-
On the backlog:
193
-
- Batch mode for playlists/channels
194
-
- Local LLM translation (Llama 3 / Mistral) for offline/private use
195
-
- Web UI via Gradio or Streamlit
196
-
- Better lip-sync timing (stretch/compress TTS clips to fit original segment duration)
179
+
- Speaker diarization (`pyannote.audio`)
180
+
- Background music separation (Demucs)
181
+
- Voice conversion (RVC) post-processing
182
+
- Local LLM translation (offline)
183
+
- Web UI (Gradio / Streamlit)
197
184
198
185
---
199
186
200
187
## Contributing
201
188
202
-
Issues and PRs are open. If you're adding a new language to `language_map.json`, please include both a male and female voice where Edge TTS supports it.
203
-
204
189
```bash
205
-
# Dev install
206
190
pip install -e ".[dev]"
207
-
208
-
# Run tests
209
191
pytest tests/ -v
210
-
211
-
# Lint
212
192
ruff check .
213
193
```
214
194
195
+
Issues and PRs welcome. Include both male and female voices when adding a language to `language_map.json`.
196
+
215
197
---
216
198
217
199
## License
218
200
219
201
MIT. See [LICENSE](LICENSE).
220
202
221
-
---
222
-
223
203
*Built by Nguyen Cong Thuan Huy ([@mangodxd](https://github.com/mangodxd))*
0 commit comments