Overview
Lip Sync synchronizes lip movements in videos with new audio tracks using advanced AI motion analysis. The API creates realistic lip-sync animation that matches speech patterns, timing, and mouth movements for natural-looking results.
How It Works
Provide a source video - Upload the video with the person speaking
Provide audio - Upload the new audio track to sync to
API processes the video - AI analyzes audio and animates lip movements
Download the result - Retrieve your lip-synced video
Use Cases
Dubbing and localization - Translate videos to new languages with matching lips
Personalized messages - Create custom video messages with any voice
Educational content - Produce training videos with voiceovers
Entertainment - Create fun lip-sync content for social media
Accessibility - Add voiceovers to silent video content
Best Practices
Video Requirements
Clear, front-facing footage works best - Ensure the speaker’s face and lips are clearly
visible throughout.
Face visibility - Full face visible with minimal obstructions
Good lighting - Even lighting on the face
Stable framing - Face stays in frame throughout
Moderate motion - Avoid extreme head movements
Audio Requirements
Clear speech - Well-recorded audio without background noise
Appropriate length - Audio duration determines output length
Supported formats - MP3, WAV, AAC, FLAC
Natural pacing - Normal speaking pace for best results
Matching Audio to Video
Factor Recommendation Duration Audio and video should be similar length Expression Match emotional tone between audio and video Language Works across languages Multiple speakers Best with single speaker
Code Examples
Basic Lip Sync
from magic_hour import Client
import os
client = Client( token = os.getenv( "MAGIC_HOUR_API_KEY" ))
result = client.v1.lip_sync.generate(
assets = {
"audio_file_path" : "https://raw.githubusercontent.com/runshouse/Sample_Assets/main/you-are-just-a-line-of-code.mp3" ,
"video_file_path" : "https://raw.githubusercontent.com/runshouse/Sample_Assets/main/sideeyegirl.mp4" ,
"video_source" : "file"
},
end_seconds = 2 ,
start_seconds = 0 ,
max_fps_limit = 30 ,
style = {
"generation_mode" : "lite"
},
name = "Side Eye Girl Code Lip Sync" ,
wait_for_completion = True ,
download_outputs = True ,
download_directory = "./outputs/"
)
if result.status == "complete" :
print ( f "✅ Lip sync complete!" )
print ( f "Downloaded to: { result.downloaded_paths } " )
print ( f "Credits charged: { result.credits_charged } " )
else :
print ( f "❌ Job failed with status: { result.status } " )
if hasattr (result, 'error_message' ):
print ( f "Error: { result.error_message } " )
Pricing
Lip Sync uses credits based on video duration:
Duration Approximate Credits 5 seconds ~150 credits 10 seconds ~300 credits
API Reference
Lip Sync API Reference View full API specification