--- license: apache-2.0 language: - ne - en tags: - talking-head - lip-sync - audio-driven - coreml - tensorrt - webgpu - onnx library_name: ampixa-talkinghead pipeline_tag: image-to-video --- # ampixa-talkinghead One photo + a speech clip → a lip-synced talking-head video. Real time on Apple silicon (M4 Pro, M3 Pro) and on an RTX 3050 Ti laptop GPU with TensorRT (40 ms/frame, just 25 fps); 168-169 MB per platform. Built and evaluated for **Nepali and English**. Code: [github.com/Ampixa/talkinghead](https://github.com/Ampixa/talkinghead) · Try it in your browser: [ampixa.com/talkinghead](https://ampixa.com/talkinghead) ```bash pip install "git+https://github.com/Ampixa/talkinghead.git" # Apple silicon / CPU pip install "ampixa-talkinghead[tensorrt] @ git+https://github.com/Ampixa/talkinghead.git" # NVIDIA ``` ```python from ampixa_talkinghead import Avatar Avatar("photo.jpg").speak("speech.wav", "out.mp4") ``` ## Measured | | | |---|---| | Render loop, Apple M4 Pro (Core ML) | 36.5 ms/frame (≈27 fps) | | Render loop, Apple M3 Pro (Core ML) | 39.9 ms/frame (25 fps) | | Render loop, RTX 3050 Ti laptop (TensorRT) | 40.0-40.5 ms/frame (25 fps; networks alone 25.7 ms) | | Download per machine | 169 MB (Apple silicon), 168 MB (NVIDIA) | | Peak memory | ~1.7 GB during `speak()` | | Lip sync | close to Ditto, not equal: an earlier full-quality build scored SyncNet LSE-C 5.23 vs Ditto's 5.31 (15 Nepali + English cases); the real-time renderer shipped here scored 0.51 lower than Ditto on a 7-case gate. Details: [GitHub README](https://github.com/Ampixa/talkinghead#measured) | ## Files | folder | what | used on | |---|---|---| | `common/` | face setup, audio and motion models | every platform | | `coreml/` | real-time renderer | Apple silicon | | `onnx/` | real-time renderer (TensorRT engines are built on first use) | NVIDIA | | `realtime/` | real-time renderer, PyTorch | fallback | | `full/` | full-quality renderer, PyTorch | offline / CPU | | `web/` | every network as ONNX for onnxruntime-web (WebGPU) | the browser demo | The library downloads only the folders your machine needs. `MANIFEST.json` lists every file with its sha256. ## In the browser [ampixa.com/talkinghead](https://ampixa.com/talkinghead) runs the whole pipeline on the visitor's own GPU (WebGPU): the models in `web/` download from this repo once, and nothing is uploaded. It is **not real time** in a browser: about 245 ms per frame on an M4 Pro (a 10 s clip takes about a minute), because a browser cannot use the Neural Engine that the native Core ML path uses. Lip sync matches the Python package (SyncNet LSE-C on the same inputs: 5.66 vs 5.44, 4.54 vs 4.63). Needs a recent Chrome or Edge (WebGPU, WebCodecs, JSPI). ## Demos Paintings (public domain) with voices from [sanoTTS](https://huggingface.co/ampixa/sanoTTS); people from the package's `examples/` speaking Nepali and English ([FLEURS](https://huggingface.co/datasets/google/fleurs), CC BY 4.0). Photo credits (Wikimedia Commons): face04 Bibek Raut (CC BY-SA 4.0), face05 MaximusPrasad (CC BY-SA 4.0), face06 Nithi Anand (CC BY 2.0), face13 Dr. Hans-Günter Wagner (CC BY-SA 2.0), face15 Jeremy Bishop (CC0). Demo videos made from CC BY-SA photos are shared under CC BY-SA. ## Limits - Works best with a frontal photo, mouth **closed** (visible teeth stop the mouth from closing while speaking). - Weak on stylised paintings with heavy beards / brushwork, very small faces in full-body shots, and profiles. - Do not use it to impersonate real people or to make anyone appear to say things they did not say. ## Licence Apache-2.0. Derived from [Ditto](https://github.com/antgroup/ditto-talkinghead) (Apache-2.0) and LivePortrait / S2G-MDDiffusion (MIT); see `NOTICE` in the code repository. The face crop uses MediaPipe (Apache-2.0).