OpenTalker/SadTalker Technical Documentation

SadTalker GitHub Guide: Setup, RTX 4090 Benchmarks & Fixes

Everything the official GitHub README leaves out: complete architecture breakdown, step-by-step cross-platform installations for Ubuntu, Windows, and macOS, real nvtop GPU activity recordings, and verified fixes for undocumented TorchVision and Gradio errors.

Official Repository
OpenTalker/SadTalker
CVPR 2023 Paper
Stars & Community
14.1k Stars / 2.7k Forks
Active Community
RTX 4090 Speed
40.49s Total Time
GFPGAN Face Enhancer
Code License
Apache 2.0
Non-Commercial Models

Official Repository Details

Verified GitHub source, release status, and distinction between official and fork repos.

github.com/OpenTalker/SadTalker

Repository Identity

The primary upstream repository is maintained by OpenTalker (originating from Xi'an Jiaotong University and Tencent AI Lab). While older tutorials refer to Winfredy/SadTalker, OpenTalker is the current authoritative upstream.

Key Project Milestones

  • 512x512px Beta Model: High-definition face texture synthesis released in v0.0.2.
  • Watermark Removed: The default diagnostic watermark was permanently retired in subsequent releases.
  • Full-Image Mode: Added --preprocess full to animate portraits without cropping.

Commercial License Clarity

The code itself is published under the permissive Apache 2.0 License. However, the pretrained 3DMM and landmark extraction checkpoints incorporate non-commercial research models (such as BFM and GFPGAN). For commercial deployment, weights must be retrained on open-domain datasets.

SadTalker Folder Structure Explained

Understanding what each directory does saves hours of troubleshooting when locating model weights, customizing output paths, or inspecting rendering pipelines.

What Every Folder Does

checkpoints/

Stores pre-trained model weights including SadTalker_V0.0.2_256.safetensors, SadTalker_V0.0.2_512.safetensors, and 3DMM coefficients. Populated via scripts/download_models.sh.

gfpgan/weights/

Contains the offline face restoration models (GFPGANv1.4.pth and parsing models) for sharp skin pores, natural teeth, and pupil clarity.

src/

Core deep learning algorithms: audio2exp (mel-spectrogram to expression), audio2pose (head nod/tilt), and facerender (PyTorch neural renderer).

results/

Default output destination organized by timestamp folders (e.g., ./results/2026_09_12_08.59.12/). Contains both raw generated mp4 and enhanced mp4 files.

examples/

Sample speech audio files (driven_audio/*.wav) and reference portrait test photos (source_image/*.png).

Which File Should Beginners Run?

app_sadtalker.pyLocal GUI

Spawns a local Gradio browser interface on http://127.0.0.1:7860. Features drag-and-drop image and audio inputs, slider-based expression settings, and instant video preview.

inference.pyProduction & Speed

The headless CLI engine. Ideal for automated cloud servers, batch pipelines, Vast.ai and RunPod instances, and fine-tuning generation arguments without browser overhead.

webui.bat / webui.sh1-Click Auto Setup

Automated bootstrapping scripts. On Windows, double-clicking webui.bat creates a virtual environment, installs PyTorch, pulls checkpoints, and launches Gradio automatically.

Recommendation: For the highest resolution rendering, run inference.py with --size 512 --still --enhancer gfpgan to maximize facial fidelity and prevent neck jitter.
Hardware Performance Verification

NVIDIA GeForce RTX 4090: nvtop & Speed Test

We benchmarked SadTalker on a dedicated 24GB RTX 4090 system executing complete 3D facial modeling, landmark tracking, neural rendering, and GFPGAN face restoration. Watch the real-time nvtop capture below.

nvtop GPU Load Recording (MP4)1x RTX 4090 (24GB)
Video Insight: Real-time nvtop monitoring demonstrates GPU compute spikes during 3DMM extraction and steady 40-70% tensor core utilization while GFPGAN processes 281 frames at 10.60 it/s.

Inference Execution Times

Real: 40.490s
3DMM & Landmark Det34.00 it/s (0.02s)
Mel & Audio2Exp767.66 it/s (0.15s)
Face Renderer (141 frames)18.48 it/s (7.63s)
Face Enhancer (281 frames)10.60 it/s (26.51s)
Total Wall Clock Time40.49 Seconds
User CPU Time:1m 50.194s
System Time:0m 20.022s
Test Hardware Rig Specifications
GPU: NVIDIA RTX 4090 24GB
Driver: 570.172.08 (CUDA 12.8)
CPU: AMD Ryzen 9 7950X (32 vCPUs)
RAM: 64 GB DDR5
Storage: Samsung 990 EVO 2TB NVMe
Host: Vast.ai Cloud ($0.469/hr)
1. nvidia-smi Hardware Verification (RTX 4090 24GB, CUDA 12.8)
nvidia-smi terminal command verifying RTX 4090 24GB VRAM and CUDA 12.8

nvidia-smi terminal output confirming RTX 4090 24,564 MiB VRAM and driver 570.172.08

2. Vast.ai Host Machine Details (Ryzen 9 7950X, 64GB RAM, NVMe SSD)
Vast.ai RTX 4090 instance dashboard details

Vast.ai cloud instance specification details and benchmark performance rating

3. Terminal Output with Stage Latency Breakdown (40.490s Real Time)
time python inference.py execution showing 40.490s benchmark

Inference execution showing 3DMM extraction, 18.48 it/s face renderer, and 10.60 it/s GFPGAN enhancement

Hardware Requirements: VRAM, Disk & Compute

SadTalker requires significant VRAM when running 512px resolution with the GFPGAN enhancer. Here is what your hardware needs:

ComponentMinimum (256px)Recommended (512px)Production / Cloud Rig
GPU VRAM4 GB (GTX 1660 / RTX 3050)8 GB - 12 GB (RTX 3060 / 4070)16 GB - 24 GB (RTX 4090 / A100)
CUDA VersionCUDA 11.3+CUDA 11.8 - 12.4CUDA 12.4 - 12.8
System RAM8 GB16 GB - 32 GB32 GB - 64 GB
Disk Storage12 GB free space25 GB SSD space50 GB NVMe
Inference Latency~2.5 to 4 minutes~60 to 90 seconds40.49 seconds
Step-by-Step Deployment

Complete Cross-Platform Installation

Select your target operating system below for tailored terminal commands, prerequisite checks, and real screenshot evidence from verified environments.

1

Update Ubuntu & Install Critical Prerequisites

SadTalker depends on FFmpeg for combining the generated video frames with the driven audio wav file. Missing FFmpeg causes unhandled Python subprocess errors during audio muxing.

Ubuntu System Update & Dependencies
bash
apt update && apt install -y git ffmpeg wget python3-pip
apt update and apt install git ffmpeg wget command execution on Ubuntu

Live output of apt update and dependency installations

2

Clone Repository & Create Isolated Python 3.8 Conda Environment

The official repository is optimized for Python 3.8. Using Python 3.11 or 3.12 triggers wheel compilation failures for older PyTorch dependencies and facial landmark libraries.

Git Clone & Conda Environment Setup
bash
# Clone official repo
git clone https://github.com/OpenTalker/SadTalker.git
cd SadTalker

# Create and activate Python 3.8 environment
conda create -n sadtalker python=3.8 -y
conda activate sadtalker
Prerequisite Fallback: If your environment does not inherit system-level FFmpeg, execute:
conda install -c conda-forge ffmpeg -y
3

Install PyTorch & Repository Requirements

Install PyTorch with CUDA acceleration before running the main requirements file.

PyTorch & Requirements Installation
bash
# Install PyTorch with CUDA support
pip install torch torchvision torchaudio

# Install repository requirements
pip install -r requirements.txt
pip install torch torchvision torchaudio output

PyTorch CUDA Wheel Installation

pip install -r requirements.txt output

Requirements Installation

4

Acquire Pretrained Weights & Checkpoints

SadTalker provides a dedicated bash script to fetch the essential checkpoints into checkpoints/ and gfpgan/weights/.

Checkpoints Fetch Script
bash
bash scripts/download_models.sh
bash scripts/download_models.sh execution in terminal

Model Weights Fetched Automatically

5

Launch: Local Gradio WebUI or Headless CLI

Choose whether to interact via the web browser or execute batch jobs directly from the terminal.

Option A: Launch WebUI (Port 7860)

WebUI Launch Command
bash
python app_sadtalker.py
Running python app_sadtalker.py in terminal

Gradio local web server initialization

Gradio active local and public demo link

Active Gradio URL and live demonstration interface link

SadTalker Gradio interactive browser interface

SadTalker Gradio WebUI running locally with source image and audio inputs

Option B: Headless CLI Inference

CLI Inference Command
bash
time python inference.py \
  --driven_audio ./examples/driven_audio/bus_chinese.wav \
  --source_image ./examples/source_image/full_body_1.png \
  --result_dir ./results \
  --enhancer gfpgan
Executing python inference.py command

CLI inference execution with driven audio and source image

Python inference execution time details

Terminal output with detailed stage execution timings

Troubleshooting & Compatibility

Fixes for Undocumented GitHub Errors

When installing SadTalker on modern operating systems or recent PyTorch environments, users frequently encounter unmaintained third-party library breakages. Here are the verified single-line command fixes:

1. ModuleNotFoundError: No module named 'torchvision.transforms.functional_tensor'

Common Bug

Cause: In newer releases of torchvision, the internal module functional_tensor was deprecated and unified into torchvision.transforms.functional. The basicsr dependency still imports the legacy path.

Single-Line Fix (Auto-patch degradations.py)
bash
sed -i 's/from torchvision.transforms.functional_tensor import rgb_to_grayscale/from torchvision.transforms.functional import rgb_to_grayscale/' $(python -c "import site; print(site.getsitepackages()[0])")/basicsr/data/degradations.py

2. AttributeError: 'Row' object has no attribute 'style'

Gradio Mismatch

Cause: Running python app_sadtalker.py with modern Gradio 4.x fails because Gradio removed the .style() method.

Single-Line Fix (Pin compatible Gradio version)
bash
pip install "gradio==3.41.2"

3. ModuleNotFoundError: No module named 'TTS'

Optional Voice Feature

Cause: Coqui TTS is optional for the voice cloning tab in the Gradio WebUI. If you need voice synthesis directly inside the demo, install Coqui TTS:

Single-Line Fix
bash
pip install TTS==0.13.3

4. Missing FFmpeg Subprocess / Audio Not Synced

Muxing Error

Cause: Python generates the raw video frames successfully, but fails at the final step when combining the audio track because FFmpeg is absent in the Conda environment binary PATH.

Fix via Conda-Forge
bash
conda install -c conda-forge ffmpeg -y

Production CLI Flags & Parameter Guide

Essential command-line arguments to eliminate head wobbling, restore sharp skin details, and render full body portraits.

--still

Stabilizes Head & Shoulders: Essential for professional presenters, e-learning instructors, and corporate narrators. It locks global neck rotations so the portrait remains steady while only the mouth and subtle facial expressions animate.

--preprocess [crop | resize | full]

Cropping Mode: crop zooms into the face for maximal detail; resize keeps the portrait frame; full animates the face seamlessly within the full original source picture.

--enhancer gfpgan

Facial Super-Resolution: Passes the generated frames through GFPGAN v1.4 to restore crisp eyelashes, clear pupils, teeth definition, and high-frequency skin textures.

--size [256 | 512]

Model Resolution: 256 provides fast rendering with low VRAM; 512 activates the high-definition face model released in v0.0.2.

Recommended Production Command:

Optimal Quality & Head Stability Command
bash
python inference.py \
  --driven_audio ./narration.wav \
  --source_image ./presenter.png \
  --result_dir ./results \
  --size 512 \
  --still \
  --preprocess crop \
  --enhancer gfpgan

Setup Cheatsheets & Automation Notebooks

Get ready-to-run automation files tested on modern NVIDIA GPUs. Upload to Vast.ai, Colab, or execute on your local workstation.

Jupyter Execution Notebook

Ready-to-upload notebook for JupyterLab, Vast.ai, or Google Colab. Includes GPU verification, automated bug patches, and timing benchmarks.

Get sadtalker_run_notebook.ipynb

Automated Shell Setup Script

Automated bash script for Ubuntu and Linux. Checks system FFmpeg, creates conda env, installs dependencies, patches basicsr, and fetches models.

Get sadtalker-setup-cheatsheet.sh

Frequently Asked Questions (GitHub & Local Setup)

Straightforward answers to the most common questions across the SadTalker GitHub issue tracker.

Explore More SadTalker Resources