Real-time face swap and video deepfake with a single click and only a single image.
- Select a face
- Select which camera to use
- Press live!
Note: These instructions are for advanced users. If unsure, consider downloading the prebuilt version for easier setup.
Ensure the following are installed on your system:
- Anaconda or Miniconda: Used for creating isolated Python environments, which helps manage dependencies and avoid conflicts.
- pip: Python's package manager, necessary for installing additional Python packages.
- git: A version control system for cloning and managing repositories.
- ffmpeg: A multimedia framework needed for handling video processing.
- Visual Studio 2022 Runtimes: Provides necessary libraries for running applications on Windows.
- Nvidia CUDA 12.1.1 & cuDNN 8.9.7: Required for GPU acceleration, enabling faster computation.
This setup is optimized for systems with a GPU.
- Open the Anaconda prompt. This is a command-line interface for managing Conda environments.
- Run the following commands to create and activate a new environment:
conda create -n dlcam-win python=3.10
conda activate dlcam-win
Use Git to clone the project repository to your local machine:
git clone https://github.com/KeyStrokeVII/DLCam-Win.git
cd DLCam-Win
-
Download these pre-trained models, which are essential for the application's functionality:
-
Move the downloaded files to the
models
folder in theDLCam-Win
directory. This ensures the application can access them during execution.
-
Install the necessary Python libraries specified in the requirements.txt file:
pip install -r requirements.txt
Utilize your NVIDIA GPU to speed up processing.
-
Install CUDA Toolkit 12.1.1: Download and install CUDA Toolkit version 12.1.1 from the NVIDIA website if you have not. This toolkit is essential for enabling GPU computation.
-
Install ONNX Runtime with GPU Support:
pip uninstall onnxruntime onnxruntime-gpu pip install onnxruntime-gpu==1.16.3
-
Run with CUDA:
python run.py --execution-provider cuda
The --execution-provider cuda flag ensures the application uses the NVIDIA GPU for processing.
Create a batch file for easier execution
- Add Conda to PATH Environment Variable: Include the
condabin
directory in your system's PATH. This allows you to useconda
commands directly in the Command Prompt. Typically found atC:\Users\<YourUsername>\miniconda3\condabin
. (adjust the path based on your actual installation location).
-
Modify
run-cuda.bat
in theDLCam-Win
directory.@echo off REM Use the full path to activate Conda call C:\Users\<YourUsername>\miniconda3\condabin\conda.bat activate your_env_name REM Run the Python script with CUDA python run.py --execution-provider cuda REM Pause to keep the window open after execution pause
- Replace
<YourUsername>
: Use your actual Windows username to ensure the batch file can find your Conda installation. - Verify Execution Provider: Ensure
cuda
is a valid option inrun.py
to enable GPU acceleration. - Run the Batch File: Double-click
run-cuda.bat
to execute. This will open a command prompt, activate the Conda environment, and run the application with CUDA support.
Keep your application up-to-date with the latest changes.
-
Navigate to Local Repository: Open your Command Prompt or Anaconda Prompt and navigate to your cloned
DLCam-Win
project directory:cd path/to/your/repository
Replace
path/to/your/repository
with the actual path to where you cloned theDLCam-Win
repository. -
Add Upstream Remote: Add the original project repository as a remote named "upstream":
git remote add upstream https://github.com/hacksider/Deep-Live-Cam.git
This command adds a remote connection named "upstream" that points to the official repository.
-
Modify
update.bat
in theDLCam-Win
directory.@echo off REM Navigate to the local Git repository cd path\to\your\repository REM Replace with your actual repository path! cd DLCam-Win REM Fetch updates from the upstream repository git fetch upstream REM Switch to the main branch git checkout main REM Merge changes from the upstream's main branch into the local main branch git merge upstream/main REM Push the merged changes to your origin repository (optional, only if you have your own fork and want to update it) git push origin main REM Pause to keep the command prompt open after execution pause
- Enter Repository Path: Crucially, you must edit the second line
cd path\to\your\repository
in theupdate.bat
file and replacepath\to\your\repository
with the actual full path to yourDLCam-Win
project directory on your system. For example, if you cloned it toC:\Users\YourUsername\Documents\DLCam-Win
, the line should becd C:\Users\YourUsername\Documents\DLCam-Win
. - Ensure Upstream is Set: Make sure you have successfully run the "Adding the Upstream Repository" steps once before using
update.bat
for the first time. - Run
update.bat
: Whenever you want to update your local application to the latest version, simply double-click theupdate.bat
file. This will:- Navigate to your project directory.
- Fetch the latest changes from the official "upstream" repository.
- Switch to the
main
branch of your local repository. - Merge the fetched updates from the upstream
main
branch into your localmain
branch. - (Optionally) Push these merged changes to your own remote repository (if you have forked the project on GitHub).
- Pause the command prompt so you can review the output of the update process.
- ffmpeg: for making video-related operations easy
- deepinsight: for their insightface project which provided a well-made library and models. Please be reminded that the use of the model is for non-commercial research purposes only.
- havok2-htwo: for sharing the code for webcam
- GosuDRM: for the open version of roop
- pereiraroland26: Multiple faces support
- vic4key: For supporting/contributing to this project
- kier007: for improving the user experience
- qitianai: for multi-lingual support
- and all developers behind libraries used in this project.
- Footnote: Please be informed that the base author of the code is s0md3v
- All the wonderful users who helped make this project go viral by starring the repo ❤️