Deep live cam

From TerminalSkills/skills · View interactive version

Deep live cam is an AI agent skill from the GitHub repository TerminalSkills/skills. Real-time face swap and video deepfake using a single source image. Use when: building face-swap applications, real-time video effects, virtual try-on features, AI video effects pipelines.

How to use this skill

Skill file

Deep-Live-Cam — Real-Time Face Swap

Overview

Real-time face swap and video deepfake using a single source image. Supports webcam, video files, and streaming with GPU acceleration. The pipeline detects faces, extracts embeddings, swaps faces using the inswapper model, and post-processes with GFPGAN/CodeFormer for quality.

Source: hacksider/Deep-Live-Cam

Instructions

1. Install and configure

The README targets Python 3.14 (3.11-3.14 supported; 3.10 no longer works because onnxruntime dropped it), plus git and ffmpeg. Use a virtual environment.

git clone --depth 1 https://github.com/hacksider/Deep-Live-Cam.git
cd Deep-Live-Cam
python3.14 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Download the two models into models/ (from the project's Hugging Face repository, hacksider/deep-live-cam): inswapper_128_fp16.onnx and gfpgan-1024.onnx. Compare each file's SHA256 with the value shown on its Hugging Face file page (sha256sum models/*.onnx) before first use. Other models are in the same repository; the first run also fetches roughly 300 MB of supporting models.

GPU acceleration is chosen with --execution-provider. requirements.txt already pins onnxruntime-gpu on Linux/Windows and the CoreML-capable onnxruntime on Apple Silicon:

2. Run face swap

GUI mode (image, video and live webcam):

python run.py

Pick a source face and a target, press Start for image/video, or Live for the webcam (the preview takes 10-30 seconds to appear). To stream, capture the preview window with OBS.

CLI mode starts whenever -s/--source is given. The README marks the CLI as unmaintained, so check python run.py --help on your checkout:

python run.py -s speaker_headshot.jpg -t conference_talk.mp4 -o outputs/anonymized_talk.mp4 \
  --keep-fps --execution-provider cuda --frame-processor face_swapper face_enhancer

3. Key features and flags

Examples

Example 1: Swap a face in a conference recording

python run.py -s speaker_headshot.jpg -t conference_talk.mp4 -o outputs/anonymized_talk.mp4 \
  --keep-fps --execution-provider cuda --frame-processor face_swapper face_enhancer

The program extracts frames, swaps and enhances each one on the GPU, and re-encodes the video with the original audio. Expect a long run for a 45-minute file; the output is outputs/anonymized_talk.mp4.

Example 2: Programmatic face swap with Python

import cv2
import insightface
from insightface.app import FaceAnalysis

app = FaceAnalysis(name="buffalo_l", providers=["CUDAExecutionProvider"])
app.prepare(ctx_id=0, det_size=(640, 640))

swapper = insightface.model_zoo.get_model(
    "models/inswapper_128_fp16.onnx",
    providers=["CUDAExecutionProvider"]
)

source_img = cv2.imread("actor_headshot.jpg")
target_img = cv2.imread("movie_scene_frame.jpg")

source_faces = app.get(source_img)
target_faces = app.get(target_img)

if source_faces and target_faces:
    result = swapper.get(target_img, target_faces[0], source_faces[0], paste_back=True)
    cv2.imwrite("swapped_scene.jpg", result)

Example 3: Real-time webcam with mouth mask

python run.py --mouth-mask --execution-provider cuda

The GUI opens; choose a source face image, pick the camera, enable mouth mask in the UI if it is not already on, and press Live. Frame rate depends on the GPU.

Guidelines

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.