screencastgen

LatentSync Provider

High-quality lip-sync video generation using LatentSync.

Source: screencastgen/providers/lipsync/latentsync_provider.py


Overview

Generates lip-synced face videos by running LatentSync in a subprocess. Supports quality presets and manages session caching for performance.


Presets

LatentSyncPreset (Dataclass)

Preset Resolution Description
small 256px Fast, suitable for small face overlays
quality 512px High quality, larger face overlays

Each preset specifies:


Function

run_latentsync(video_path, audio_path, output_path, device="auto", preset="quality")

  1. Finds the LatentSync installation directory (via env var or path search)
  2. Selects config and checkpoint for the preset
  3. Spawns a worker subprocess (latentsync_worker.py)
  4. Manages session caching and timeouts

download_latentsync_checkpoints(args)

Downloads LatentSync model checkpoints. Called by Models.


LatentSync Discovery

Finds the LatentSync root directory by:

  1. Checking LATENTSYNC_ROOT environment variable
  2. Searching common paths

Dependencies

LatentSync Provider
├── latentsync         (external installation)
├── subprocess         (worker process)
├── TTS Base        (resolve_device)
└──▶ registered in Lipsync Registry
     └──▶ called by Lipsync Facade

See Also