Skip to main content
POST
/
v1
/
lip-sync
Python
from magic_hour import Client
from os import getenv

client = Client(token=getenv("API_TOKEN"))
res = client.v1.lip_sync.generate(
    assets={
        "audio_file_path": "/path/to/1234.mp3",
        "video_file_path": "/path/to/1234.mp4",
        "video_source": "file",
    },
    style={
        "generation_mode": "lite",
    },
    end_seconds=15.0,
    start_seconds=0.0,
    max_fps_limit=12.0,
    name="Lip Sync video",
    wait_for_completion=True,
    download_outputs=True,
    download_directory="."
)
{
  "id": "cuid-example",
  "credits_charged": 450
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <api_key>, where <api_key> is your API key. To get your API key, go to Developer Hub and click "Create new API Key".

Body

application/json

Body

start_seconds
number<float>
required

Start time of your clip (seconds). Must be ≥ 0.

Required range: x >= 0
Example:

0

end_seconds
number<float>
required

End time of your clip (seconds). Must be greater than start_seconds.

Required range: x >= 0.1
Example:

15

assets
object
required

Provide the assets for lip-sync. For video, The video_source field determines whether video_file_path or youtube_url field is used

name
string
default:Lip Sync - dateTime

Give your video a custom name for easy identification.

Example:

"My Lip Sync video"

max_fps_limit
number

Defines the maximum FPS (frames per second) for the output video. If the input video's FPS is lower than this limit, the output video will retain the input FPS. This is useful for reducing unnecessary frame usage in scenarios where high FPS is not required.

Required range: x >= 1
Example:

12

style
object

Attributes used to dictate the style of the output

Response

Success

Success

id
string
required

Unique ID of the video. Use it with the Get video Project API to fetch status and downloads.

Example:

"cuid-example"

credits_charged
integer
required

The amount of credits deducted from your account to generate the video. If the status is not 'complete', this value is an estimate and may be adjusted upon completion based on the actual FPS of the output video.

If video generation fails, credits will be refunded, and this field will be updated to include the refund.

Example:

450