Facade for lip-sync video generation from audio + reference video.
Source: screencastgen/lipsync.py
Provides a stable API for lip-sync generation, delegating to providers in Lipsync Registry. Handles video looping to match audio duration.
generate_lipsync_video(audio_path, reference_video_path, output_path, provider, device, latentsync_preset) -> strGenerates a lip-synced video from audio and a reference face video.
Parameters:
| Param | Type | Default | Description |
|---|---|---|---|
audio_path |
str |
— | Path to audio file |
reference_video_path |
str |
— | Path to face reference video |
output_path |
str |
— | Output video path |
provider |
str |
"auto" |
Lipsync provider name |
device |
str |
"auto" |
Compute device |
latentsync_preset |
str |
"quality" |
LatentSync quality preset |
_get_audio_duration(audio_path) -> floatReturns duration of an audio file in seconds.
_loop_video_to_duration(video_path, duration, output_path) -> strLoops a reference video to match the target audio duration using ffmpeg.
Lipsync Facade
├── Lipsync Registry (provider dispatch)
├── TTS Base (resolve_device)
├── ffmpeg CLI (video looping)
└──▶ consumed by Lipsync Pipeline
└──▶ or Remote GPU Client (remote mode)