Deepfake technology often demands heavy computational power and specialized hardware, making real-time face swapping a challenge for most users. Deep-Live-Cam addresses this by supporting a range of hardware through ONNX Runtime’s multiple execution providers, enabling real-time performance whether you’re on a high-end NVIDIA GPU, a Mac with Apple Silicon, or an Intel CPU.
What Deep-Live-Cam does and how it’s built
Deep-Live-Cam is an open-source Python application designed for real-time face swapping and video deepfake generation. It supports input from images, videos, and live webcam streams, applying AI-driven face swapping in a way that makes it accessible beyond just powerful desktop setups.
At its core, the project uses pre-trained models like GFPGANv1.4 for face restoration and inswapper_128_fp16.onnx for face swapping. These models are loaded and executed through ONNX Runtime, a cross-platform high-performance inference engine. What makes this repo particularly practical is its support for multiple execution providers: CUDA for NVIDIA GPUs, CoreML for Apple Silicon, DirectML for Windows-compatible GPUs, and OpenVINO for Intel CPUs.
This flexible backend approach allows the same codebase to run efficiently on a variety of hardware without rewriting or recompiling models. The repo includes Python scripts and utilities to manage video and image inputs, perform face detection and alignment, and then apply the swapped faces in real time.
The architecture is modular, separating concerns between model loading, preprocessing, inference, and postprocessing. This keeps the codebase manageable despite the complexity of real-time video processing and AI inference.
Optimizing real-time deepfakes with ONNX Runtime execution providers
What distinguishes Deep-Live-Cam is its pragmatic use of ONNX Runtime’s execution providers to optimize inference speed across hardware. Instead of locking users into a single framework or requiring them to manually configure hardware-specific pipelines, the repo detects and switches between execution backends based on the user’s environment.
This means if you have a discrete NVIDIA GPU, the CUDA execution provider is used to accelerate inference. On Apple Silicon, CoreML powers the inference for efficient utilization of the hardware’s neural engine. Windows users with compatible GPUs can benefit from DirectML, while Intel CPU users get OpenVINO acceleration.
The tradeoff here is clear: to maintain broad hardware compatibility and performance, the codebase depends on the ONNX Runtime abstraction layer, which may introduce some overhead compared to hand-optimized native implementations. However, this overhead is minimal compared to the benefit of running on multiple platforms without code changes.
The code quality reflects this balance. The repo maintains clear abstractions for model execution and input handling, but users need some familiarity with Python environments and dependencies. The project also includes ethical guidelines and content restrictions embedded in the tool to encourage responsible use, which is a thoughtful addition given the nature of deepfake technology.
The code is surprisingly clean given the challenges of real-time video processing combined with AI model inference. It uses well-known libraries for video capture, face detection, and image processing alongside ONNX Runtime.
Exclusive v2.7 beta Quick Start - Pre-built (Windows/Mac Silicon/CPU)
This is the fastest build you can get if you have a discrete NVIDIA or AMD GPU, CPU or Mac Silicon, And you’ll receive special priority support. 2.7 beta is the best you can have with 30+ extra features than the open source version.
These Pre-builts are perfect for non-technical users or those who don’t have time to, or can’t manually install all the requirements. Just a heads-up: this is an open-source project, so you can also install it manually.
Installation (Manual)
Please be aware that the installation requires technical skills and is not for beginners. Consider downloading the quickstart version.
Click to see the process
Installation
This is more likely to work on your computer but will be slower as it utilizes the CPU.
1. Set up Your Platform
- Python (3.11 recommended)
- pip
- git
- ffmpeg -
iex (irm ffmpeg.tc.ht) - Visual Studio 2022 Runtimes (Windows)
2. Clone the Repository
git clone https://github.com/hacksider/Deep-Live-Cam.git
cd Deep-Live-Cam
3. Download the Models
- GFPGANv1.4
- inswapper_128_fp16.onnx
Place these files in the “models” folder.
4. Install Dependencies
We highly recommend using a venv to avoid issues.
For Windows:
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
For Linux:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
verdict
Deep-Live-Cam is a solid choice if you want to experiment with real-time face swapping and deepfake generation on your own hardware without investing in specialized expensive GPUs. The flexibility to run efficiently on NVIDIA GPUs, Apple Silicon, and even Intel CPUs through ONNX Runtime is the project’s clear strength.
That said, the installation and setup are not for beginners, especially if choosing the manual route. The performance you get depends heavily on your hardware and the execution provider used. The open-source version is feature-rich but slightly behind the exclusive 2.7 beta builds that offer additional capabilities and better support.
The codebase is well-structured and reflects practical tradeoffs between broad hardware compatibility and real-time performance. If you have the technical skills and interest in AI-powered video manipulation, this repo is worth exploring.
If your goal is high-fidelity or production-ready deepfake video generation, you’ll need to consider the limitations of real-time inference and the ethical implications the project responsibly highlights.
Related Articles
- Hugging Face Transformers: a unified API for state-of-the-art AI models across modalities — Hugging Face Transformers offers a unified Python API to access over 1 million pretrained AI models for text, vision, an
- Keras 3: Multi-backend deep learning framework simplifying model development across JAX, TensorFlow, and PyTorch — Keras 3 introduces a multi-backend architecture supporting JAX, TensorFlow, PyTorch, and OpenVINO, enabling flexible, ac
- Hands-on with YOLOv5: A practical deep dive into Ultralytics’ PyTorch vision model — YOLOv5 by Ultralytics offers an accessible, fast, and accurate PyTorch-based computer vision toolkit for object detectio
- Netdata: real-time edge monitoring with integrated machine learning anomaly detection — Netdata delivers per-second real-time monitoring with minimal overhead. Its edge-based ML-powered anomaly detection and
- OpenAI Codex CLI: local-first AI coding assistant with ChatGPT integration — OpenAI Codex CLI brings AI coding assistance local to your terminal, integrating with ChatGPT plans for powerful hybrid
→ GitHub Repo: hacksider/Deep-Live-Cam ⭐ 92,311 · Python