--- title: VidDub emoji: 🎬 colorFrom: green colorTo: red sdk: gradio sdk_version: 6.31.0 app_file: app.py python_version: "3.10" short_description: Two-step video dubbing — re-sync lips to new speech startup_duration_timeout: 1h --- # VidDub — Replacement-Aware Distillation for Two-Step Video Dubbing **VidDub** ([paper](https://huggingface.co/papers/2611.03404)) is a two-step diffusion video-dubbing editor: given a source talking-head video and new target speech, it regenerates the speaker's lower face so the lips match the new audio — everything else is kept from the source. It is trained on a Wan2.1-VACE-1.3B backbone with a Whisper-small audio adapter, distilled with DMD to just **2 denoising steps** (flow-euler, shift 5, audio CFG 1). - 💻 Code: [LAW1223/VidDub](https://github.com/LAW1223/VidDub) - 🤗 Weights: [AIPeanutman/VidDub](https://huggingface.co/AIPeanutman/VidDub) (base: [Wan-AI/Wan2.1-VACE-1.3B](https://huggingface.co/Wan-AI/Wan2.1-VACE-1.3B), audio encoder: [openai/whisper-small](https://huggingface.co/openai/whisper-small)) ## Usage 1. Upload a source video with a single, mostly front-facing face (≥ 81 frames, i.e. ~3.4 s; longer videos are processed in 81-frame windows and truncated at the frame cap). 2. Upload the target speech audio (any common format). 3. Press **Dub video**. The output keeps the source resolution and frame rate and carries the new speech. The two-step DMD checkpoint is fixed to 2 steps / audio CFG 1 — the sampler has no user-tunable steps. Advanced options: noise seed, the paper's lower-face color harmonization, mask feather, and the frame cap. ## Implementation notes The app replicates the reference implementation (`scripts/infer.py`) 1:1: MediaPipe FaceMesh landmarks → 512² face crop + lower-face mask → VACE latents (x0 / inactive / ref) + empty-prompt T5 context + Whisper features → two-step bidirectional rollout → Lab color harmonization → feathered paste-back into the original frames → AAC muxing at 48 kHz stereo. One deviation: dubbing never uses a text prompt, so the T5 context of the empty string is precomputed once (18 KB tensor in `assets/empty_context.pt`) instead of downloading the 11 GB umt5-xxl encoder at startup. ## Licenses / credits - Example videos: CC0, from [linoyts/repo-to-space-example-videos](https://huggingface.co/datasets/linoyts/repo-to-space-example-videos). - Example speech: CC BY 4.0, from [LibriSpeech](https://huggingface.co/datasets/openslr/librispeech_asr) (Vassil Panayotov / ILSVRC & ISLR, 2015). - VidDub model weights are released under the repository's own source-available license; Wan2.1 base weights under Apache-2.0.