13,263
stars
+0+0+31
2,850
forks
180
watchers
62
prs
692
issues
0
releases
–
discussions
README
Wav2Lip: Accurately Lip-syncing Videos In The Wild
Commercial Version
Create your first lipsync generation in minutes. Please note, the commercial version is of a much higher quality than the old open source model!
Create your API Key
Create your API key from the Dashboard. You will use this key to securely access the Sync API.
Make your first generation
The following example shows how to make a lipsync generation using the Sync API.
Python
Step 1: Install Sync SDK
bash
pip install syncsdk
Step 2: Make your first generation
Copy the following code into a file quickstart.py and replace YOUR_API_KEY_HERE with your generated API key.
python
quickstart.py
import time
from sync import Sync
from sync.common import Audio, GenerationOptions, Video
from sync.core.api_error import ApiError
---------- UPDATE API KEY ----------
Replace with your Sync.so API key
api_key = "YOUR_API_KEY_HERE"
----------[OPTIONAL] UPDATE INPUT VIDEO AND AUDIO URL ----------
URL to your source video
video_url = "https://assets.sync.so/docs/example-video.mp4"
URL to your audio file
audio_url = "https://assets.sync.so/docs/example-audio.wav"
----------------------------------------
client = Sync(
base_url="https://api.sync.so",
api_key=api_key
).generations
print("Starting lip sync generation job...")
try:
response = client.create(
input=[Video(url=video_url),Audio(url=audio_url)],
model="lipsync-2",
options=GenerationOptions(sync_mode="cut_off"),
outputFileName="quickstart"
)
except ApiError as e:
print(f'create generation request failed with status code {e.status_code} and error {e.body}')
exit()
job_id = response.id
print(f"Generation submitted successfully, job id: {job_id}")
generation = client.get(job_id)
status = generation.status
while status not in ['COMPLETED', 'FAILED']:
print('polling status for generation', job_id)
time.sleep(10)
generation = client.get(job_id)
status = generation.status
if status == 'COMPLETED':
print('generation', job_id, 'completed successfully, output url:', generation.output_url)
else:
print('generation', job_id, 'failed')
Run the script:
bash
python quickstart.py
Step 3: Done!
It may take a few minutes for the generation to complete. You should see the generated video URL in the terminal post completion.
---
TypeScript
Step 1: Install dependencies
bash
npm i @sync.so/sdk
Step 2: Make your first generation
Copy the following code into a file quickstart.ts and replace YOUR_API_KEY_HERE with your generated API key.
typescript
// quickstart.ts
import { SyncClient, SyncError } from "@sync.so/sdk";
// ---------- UPDATE API KEY ----------
// Replace with your Sync.so API key
const apiKey = "YOUR_API_KEY_HERE";
// ----------[OPTIONAL] UPDATE INPUT VIDEO AND AUDIO URL ----------
// URL to your source video
const videoUrl = "https://assets.sync.so/docs/example-video.mp4";
// URL to your audio file
const audioUrl = "https