Convert Figma logo to code with AI

hacksider logoDeep-Live-Cam

real time face swap and one-click video deepfake with only a single image

47,354
7,000
47,354
20

Top Related Projects

53,524

Deepfakes Software For All

DeepFaceLab is the leading software for creating deepfakes.

This repository contains the source code for the paper First Order Motion Model for Image Animation

Avatars for Zoom, Skype and other video-conferencing apps.

11,185

This repository contains the codes of "A Lip Sync Expert Is All You Need for Speech to Lip Generation In the Wild", published at ACM Multimedia 2020. For HD commercial model, please try out Sync Labs

Quick Overview

Deep-Live-Cam is an open-source project that utilizes deep learning techniques to enhance webcam video streams in real-time. It applies various filters and effects to live video, including style transfer, object detection, and facial recognition, providing an interactive and customizable webcam experience.

Pros

  • Real-time processing of video streams using deep learning models
  • Multiple pre-trained models for various effects and filters
  • Easy-to-use interface for selecting and applying effects
  • Extensible architecture allowing for the addition of custom models and effects

Cons

  • High computational requirements for real-time processing
  • Limited documentation for advanced customization
  • Potential privacy concerns with facial recognition features
  • Dependency on specific hardware (GPU) for optimal performance

Code Examples

# Initialize the Deep-Live-Cam processor
from deep_live_cam import VideoProcessor

processor = VideoProcessor()
processor.load_model('style_transfer', 'starry_night')
# Apply a filter to a frame
import cv2

frame = cv2.imread('input_frame.jpg')
processed_frame = processor.apply_filter(frame)
cv2.imshow('Processed Frame', processed_frame)
# Start real-time webcam processing
processor.start_webcam_stream()

Getting Started

  1. Install Deep-Live-Cam:

    pip install deep-live-cam
    
  2. Import and initialize the processor:

    from deep_live_cam import VideoProcessor
    processor = VideoProcessor()
    
  3. Load a pre-trained model:

    processor.load_model('style_transfer', 'impressionist')
    
  4. Start the webcam stream with the selected effect:

    processor.start_webcam_stream()
    

Competitor Comparisons

53,524

Deepfakes Software For All

Pros of faceswap

  • More comprehensive and feature-rich, offering a wider range of tools and options for face swapping
  • Larger and more active community, resulting in frequent updates and improvements
  • Better documentation and user guides, making it easier for beginners to get started

Cons of faceswap

  • Steeper learning curve due to its complexity and extensive features
  • Requires more computational resources, which may not be suitable for all users
  • Longer processing times for training and conversion compared to simpler alternatives

Code comparison

Deep-Live-Cam:

def process_frame(frame):
    # Simple frame processing
    return processed_frame

faceswap:

def process_frame(frame, model, alignments):
    detected_faces = detect_faces(frame)
    for face in detected_faces:
        aligned_face = align_face(face, alignments)
        swapped_face = model.convert(aligned_face)
        frame = merge_face(frame, swapped_face)
    return frame

The code comparison shows that faceswap has a more complex frame processing pipeline, including face detection, alignment, and merging steps, while Deep-Live-Cam appears to have a simpler approach.

DeepFaceLab is the leading software for creating deepfakes.

Pros of DeepFaceLab

  • More comprehensive and feature-rich, offering a wide range of face swapping and manipulation tools
  • Larger community and more frequent updates, leading to better support and ongoing improvements
  • Supports both video and image processing, providing greater flexibility

Cons of DeepFaceLab

  • Steeper learning curve due to its complexity and extensive features
  • Requires more computational resources, which may not be suitable for all users
  • Installation process can be more involved, potentially intimidating for beginners

Code Comparison

DeepFaceLab:

from core.leras import nn
from facelib import FaceType
from models import ModelBase
from samplelib import *

class Model(ModelBase):
    # Complex model implementation

Deep-Live-Cam:

import cv2
import numpy as np
from tensorflow.keras.models import load_model

def process_frame(frame, model):
    # Simpler frame processing logic

DeepFaceLab offers a more sophisticated and modular approach, while Deep-Live-Cam provides a streamlined implementation focused on real-time processing. DeepFaceLab's code structure allows for greater customization and extensibility, but at the cost of increased complexity.

This repository contains the source code for the paper First Order Motion Model for Image Animation

Pros of first-order-model

  • More comprehensive and versatile, capable of handling various image animation tasks
  • Better documentation and examples, making it easier for users to understand and implement
  • Actively maintained with regular updates and improvements

Cons of first-order-model

  • More complex setup and usage, requiring more computational resources
  • Less focused on real-time applications compared to Deep-Live-Cam
  • Steeper learning curve for beginners due to its broader scope

Code Comparison

first-order-model:

from demo import load_checkpoints
generator, kp_detector = load_checkpoints(config_path='config/vox-256.yaml', 
                                          checkpoint_path='vox-cpk.pth.tar')

Deep-Live-Cam:

from deepfake import DeepFake
deepfake = DeepFake()
deepfake.load_model('path/to/model')

The code snippets show that first-order-model requires more setup and configuration, while Deep-Live-Cam offers a simpler interface for quick implementation. However, first-order-model provides more flexibility and control over the animation process.

Avatars for Zoom, Skype and other video-conferencing apps.

Pros of Avatarify-python

  • More active development with frequent updates and bug fixes
  • Supports a wider range of face manipulation techniques
  • Better documentation and community support

Cons of Avatarify-python

  • Higher system requirements, especially GPU
  • More complex setup process
  • Potentially slower performance on lower-end hardware

Code Comparison

Avatarify-python:

predictor = KPDetector(config['model_params']['common_params'], config['model_params']['kp_detector_params'])
kp_source = predictor(source_image)
generator = OcclusionAwareGenerator(**config['model_params']['generator_params'])
generated = generator(source_image, kp_source=kp_source, kp_driving=kp_driving)

Deep-Live-Cam:

model = load_model('path/to/model.h5')
face_cascade = cv2.CascadeClassifier('path/to/haarcascade_frontalface_default.xml')
faces = face_cascade.detectMultiScale(gray, 1.3, 5)
for (x,y,w,h) in faces:
    face = cv2.resize(frame[y:y+h, x:x+w], (64, 64))

The code snippets show that Avatarify-python uses a more sophisticated approach with separate predictor and generator models, while Deep-Live-Cam relies on a simpler face detection and single model inference process. This reflects the difference in complexity and capabilities between the two projects.

11,185

This repository contains the codes of "A Lip Sync Expert Is All You Need for Speech to Lip Generation In the Wild", published at ACM Multimedia 2020. For HD commercial model, please try out Sync Labs

Pros of Wav2Lip

  • More advanced lip-syncing technology, producing more realistic results
  • Supports a wider range of input formats, including audio and video files
  • Larger community and more frequent updates

Cons of Wav2Lip

  • Higher computational requirements, potentially slower processing
  • More complex setup and usage, steeper learning curve
  • Less focus on real-time applications

Code Comparison

Wav2Lip example:

from wav2lip import inference
model = inference.load_model('path/to/model')
result = inference.predict(face='input_face.mp4', audio='input_audio.wav')

Deep-Live-Cam example:

from deep_live_cam import DeepLiveCam
dlc = DeepLiveCam()
dlc.start_stream()

While Wav2Lip focuses on precise lip-syncing with pre-recorded media, Deep-Live-Cam is designed for real-time applications. Wav2Lip offers more advanced features but requires more setup, whereas Deep-Live-Cam provides a simpler interface for live streaming scenarios. The choice between the two depends on the specific use case and required level of lip-syncing accuracy.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Deep-Live-Cam

Real-time face swap and video deepfake with a single click and only a single image.

hacksider%2FDeep-Live-Cam | Trendshift

Demo GIF

Disclaimer

This deepfake software is designed to be a productive tool for the AI-generated media industry. It can assist artists in animating custom characters, creating engaging content, and even using models for clothing design.

We are aware of the potential for unethical applications and are committed to preventative measures. A built-in check prevents the program from processing inappropriate media (nudity, graphic content, sensitive material like war footage, etc.). We will continue to develop this project responsibly, adhering to the law and ethics. We may shut down the project or add watermarks if legally required.

  • Ethical Use: Users are expected to use this software responsibly and legally. If using a real person's face, obtain their consent and clearly label any output as a deepfake when sharing online.

  • Content Restrictions: The software includes built-in checks to prevent processing inappropriate media, such as nudity, graphic content, or sensitive material.

  • Legal Compliance: We adhere to all relevant laws and ethical guidelines. If legally required, we may shut down the project or add watermarks to the output.

  • User Responsibility: We are not responsible for end-user actions. Users must ensure their use of the software aligns with ethical standards and legal requirements.

By using this software, you agree to these terms and commit to using it in a manner that respects the rights and dignity of others.

Users are expected to use this software responsibly and legally. If using a real person's face, obtain their consent and clearly label any output as a deepfake when sharing online. We are not responsible for end-user actions.

Quick Start - Pre-built (Windows / Nvidia)

This is the fastest build you can get if you have a discrete NVIDIA GPU.
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.

TLDR; Live Deepfake in just 3 Clicks

easysteps

  1. Select a face
  2. Select which camera to use
  3. Press live!

Features & Uses - Everything is in real-time

Mouth Mask

Retain your original mouth for accurate movement using Mouth Mask

resizable-gif

Face Mapping

Use different faces on multiple subjects simultaneously

face_mapping_source

Your Movie, Your Face

Watch movies with any face in real-time

movie

Live Show

Run Live shows and performances

show

Memes

Create Your Most Viral Meme Yet

show
Created using Many Faces feature in Deep-Live-Cam

Omegle

Surprise people on Omegle

Installation (Manual)

Please be aware that the installation requires technical skills and is not for beginners. Consider downloading the prebuilt 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

2. Clone the Repository

git clone https://github.com/hacksider/Deep-Live-Cam.git
cd Deep-Live-Cam

3. Download the Models

  1. GFPGANv1.4
  2. 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 macOS:

Apple Silicon (M1/M2/M3) requires specific setup:

# Install Python 3.10 (specific version is important)
brew install python@3.10

# Install tkinter package (required for the GUI)
brew install python-tk@3.10

# Create and activate virtual environment with Python 3.10
python3.10 -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

** In case something goes wrong and you need to reinstall the virtual environment **

# Deactivate the virtual environment
rm -rf venv

# Reinstall the virtual environment
python -m venv venv
source venv/bin/activate

# install the dependencies again
pip install -r requirements.txt

Run: If you don't have a GPU, you can run Deep-Live-Cam using python run.py. Note that initial execution will download models (~300MB).

GPU Acceleration

CUDA Execution Provider (Nvidia)

  1. Install CUDA Toolkit 11.8.0
  2. Install dependencies:
pip uninstall onnxruntime onnxruntime-gpu
pip install onnxruntime-gpu==1.16.3
  1. Usage:
python run.py --execution-provider cuda

CoreML Execution Provider (Apple Silicon)

Apple Silicon (M1/M2/M3) specific installation:

  1. Make sure you've completed the macOS setup above using Python 3.10.
  2. Install dependencies:
pip uninstall onnxruntime onnxruntime-silicon
pip install onnxruntime-silicon==1.13.1
  1. Usage (important: specify Python 3.10):
python3.10 run.py --execution-provider coreml

Important Notes for macOS:

  • You must use Python 3.10, not newer versions like 3.11 or 3.13
  • Always run with python3.10 command not just python if you have multiple Python versions installed
  • If you get error about _tkinter missing, reinstall the tkinter package: brew reinstall python-tk@3.10
  • If you get model loading errors, check that your models are in the correct folder
  • If you encounter conflicts with other Python versions, consider uninstalling them:
    # List all installed Python versions
    brew list | grep python
    
    # Uninstall conflicting versions if needed
    brew uninstall --ignore-dependencies python@3.11 python@3.13
    
    # Keep only Python 3.10
    brew cleanup
    

CoreML Execution Provider (Apple Legacy)

  1. Install dependencies:
pip uninstall onnxruntime onnxruntime-coreml
pip install onnxruntime-coreml==1.13.1
  1. Usage:
python run.py --execution-provider coreml

DirectML Execution Provider (Windows)

  1. Install dependencies:
pip uninstall onnxruntime onnxruntime-directml
pip install onnxruntime-directml==1.15.1
  1. Usage:
python run.py --execution-provider directml

OpenVINO™ Execution Provider (Intel)

  1. Install dependencies:
pip uninstall onnxruntime onnxruntime-openvino
pip install onnxruntime-openvino==1.15.0
  1. Usage:
python run.py --execution-provider openvino

Usage

1. Image/Video Mode

  • Execute python run.py.
  • Choose a source face image and a target image/video.
  • Click "Start".
  • The output will be saved in a directory named after the target video.

2. Webcam Mode

  • Execute python run.py.
  • Select a source face image.
  • Click "Live".
  • Wait for the preview to appear (10-30 seconds).
  • Use a screen capture tool like OBS to stream.
  • To change the face, select a new source image.

Tips and Tricks

Check out these helpful guides to get the most out of Deep-Live-Cam:

Visit our official blog for more tips and tutorials.

Command Line Arguments (Unmaintained)

options:
  -h, --help                                               show this help message and exit
  -s SOURCE_PATH, --source SOURCE_PATH                     select a source image
  -t TARGET_PATH, --target TARGET_PATH                     select a target image or video
  -o OUTPUT_PATH, --output OUTPUT_PATH                     select output file or directory
  --frame-processor FRAME_PROCESSOR [FRAME_PROCESSOR ...]  frame processors (choices: face_swapper, face_enhancer, ...)
  --keep-fps                                               keep original fps
  --keep-audio                                             keep original audio
  --keep-frames                                            keep temporary frames
  --many-faces                                             process every face
  --map-faces                                              map source target faces
  --mouth-mask                                             mask the mouth region
  --video-encoder {libx264,libx265,libvpx-vp9}             adjust output video encoder
  --video-quality [0-51]                                   adjust output video quality
  --live-mirror                                            the live camera display as you see it in the front-facing camera frame
  --live-resizable                                         the live camera frame is resizable
  --max-memory MAX_MEMORY                                  maximum amount of RAM in GB
  --execution-provider {cpu} [{cpu} ...]                   available execution provider (choices: cpu, ...)
  --execution-threads EXECUTION_THREADS                    number of execution threads
  -v, --version                                            show program's version number and exit

Looking for a CLI mode? Using the -s/--source argument will make the run program in cli mode.

Press

We are always open to criticism and are ready to improve, that's why we didn't cherry-pick anything.

Credits

Stargazers

Contributions

Alt

Stars to the Moon 🚀

Star History Chart