File size: 755 Bytes
4b1c031
bac2101
4b1c031
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

from latentsync.pipelines.lipsync_pipeline import LipsyncPipeline
import torch

pipeline = LipsyncPipeline(
    scheduler=None,
    vae=None,
    audio_encoder=None,
    unet=None,
).to("cuda")

def apply_lipsync(video_input_path, audio_path, video_out_path):

    torch.manual_seed(1234)

    print(f"Initial seed: {torch.initial_seed()}")

    pipeline(
        video_path=video_input_path,
        audio_path=audio_path,
        video_out_path=video_out_path,
        video_mask_path=video_out_path.replace(".mp4", "_mask.mp4"),
        num_frames=16,
        num_inference_steps=20,
        guidance_scale=1.0,
        weight_dtype=torch.float16,
        width=256,
        height=256,
    )

    return video_out_path