Pruna AI P Video 2 Pro Lipsync API Documentation
Playground
Try it on WaveSpeedAI!Pruna AI P-Video-2 Pro Lipsync synchronizes a visible speaker’s lip movements to a replacement speech track for video dubbing and dialogue edits. Supports clips up to 60 seconds, with 24 fps output and the source aspect ratio retained. Larger videos are scaled down to fit the output resolution limit.
Features
Pruna AI P-Video-2 Pro Lipsync takes a video of someone talking and a new audio track, and generates a video with lip movements synchronized to the new speech. Use it to dub a video into another language or change a line without a reshoot.
Why Choose This?
- Dubbing without a reshoot — Replace the speech in an existing video with a new recording or another language.
- Speech synchronization — Adapt the speaker’s lip movements to a replacement speech track.
- 24 fps output — Keep the source aspect ratio, with larger videos scaled down to fit the output resolution limit.
- Up to 60 seconds — Process clips and audio of up to
60seconds. - Flat pricing — One price per second at every resolution.
Parameters
| Parameter | Required | Description |
|---|---|---|
| video | Yes | Source video URL (MP4, MOV or WebM) with a clearly visible face. Only the first 60 seconds are used. |
| audio | Yes | Audio URL (MP3, WAV, M4A or similar) with the replacement speech to lip-sync. Only the first 60 seconds are used. |
| seed | No | Optional random seed for reproducible generation. |
How to Use
- Upload a video — Provide a video of a person talking to the camera.
- Add the new audio — Provide the speech you want the person to say.
- Submit — Generate and download the lip-synced video.
The output is as long as the shorter of the video and the audio, up to 60 seconds.
Pricing
Pricing is based on the shorter input duration: the video or the audio. This duration is rounded up to a whole second, with a minimum of 1 second and a maximum of 60 seconds. The rate is $0.025/s at every supported resolution.
| Item | Price |
|---|---|
| Per second | $0.025 |
Example Costs
| Length | Price |
|---|---|
| 5s | $0.125 |
| 10s | $0.25 |
| 30s | $0.75 |
| 60s | $1.50 |
For example, a 12-second video with 9.7 seconds of audio is billed as 10 seconds ($0.25). The seed does not add a separate charge.
Best Use Cases
- Video dubbing — Put a new language on a talking-head video.
- Line changes — Fix or update a line without reshooting.
- Localized marketing — Reuse one presenter video across markets.
- Social clips — Give existing footage a new voice-over.
Pro Tips
- Use close-up to medium shots with one speaker facing the camera; this is where results are best.
- Keep the face clearly visible and well lit, and avoid hands or objects covering the mouth.
- Trim the audio to the line you need so the output is not longer than necessary.
- Use a fixed seed when comparing different audio takes.
Notes
- The task may fail if no face is detected. Use a video with a clearly visible face.
videoandaudioare required.- Output is at most
60seconds, at 24 fps. - Input videos must be no larger than 200 MB.
- Output retains the source aspect ratio. Videos with a longest side above 1920 pixels are scaled down to fit that limit.
- If the video and audio have different lengths, the output follows the shorter one.
- Use footage with a single clearly visible speaker. Generated lip movements and nearby facial details may vary.
Related Models
- P-Video-2 Pro Avatar — Animate a single photo to match a voice track.
- P-Video-2 Pro Replace — Replace people in an existing video using reference photos.
Authentication
For authentication details, please refer to the Authentication Guide.
API Endpoints
Submit Task & Query Result
set -euo pipefail
export WAVESPEED_API_KEY="your-api-key"
REQUEST_BODY=$(cat <<'JSON'
{
"video": "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4",
"audio": "https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3"
}
JSON
)
# 1. Submit the prediction once. Never retry this request automatically:
# a retry after an unclear failure can create a second, billed task.
CHECK='The task may already exist. Check History or the predictions list before submitting again.'
if ! SUBMIT_RESPONSE=$(curl --silent --show-error --fail-with-body \
--connect-timeout 10 --max-time 60 \
-X POST "https://api.wavespeed.ai/api/v3/pruna-ai/p-video-2-pro/lipsync" \
-H "Authorization: Bearer ${WAVESPEED_API_KEY}" \
-H "Content-Type: application/json" \
-d "${REQUEST_BODY}"); then
printf 'Submit failed. %s\n' "${CHECK}" >&2
exit 1
fi
TASK=$(printf '%s' "${SUBMIT_RESPONSE}" | jq 'if type == "object" and has("data") then .data else . end')
PREDICTION_ID=$(printf '%s' "${TASK}" | jq -r '.id // empty')
if [ -z "${PREDICTION_ID}" ]; then
printf 'Submission response did not contain a prediction id. %s\n' "${CHECK}" >&2
exit 1
fi
RESULT_URL="https://api.wavespeed.ai/api/v3/predictions/${PREDICTION_ID}/result"
# 2. Poll until the prediction reaches a final status.
BODY_FILE=$(mktemp)
trap 'rm -f "${BODY_FILE}"' EXIT
while true; do
# Transient errors (429, 5xx) are retried, honoring Retry-After.
HTTP_CODE=$(curl --silent --show-error --fail-with-body \
--connect-timeout 10 --max-time 60 --retry 5 --retry-delay 2 \
--output "${BODY_FILE}" --write-out '%{http_code}' \
"${RESULT_URL}" \
-H "Authorization: Bearer ${WAVESPEED_API_KEY}" || true)
case "${HTTP_CODE}" in
2??) ;;
000|429|5??) # dropped connection or temporary error: keep polling
printf 'Task %s: HTTP %s, polling again in 10s\n' "${PREDICTION_ID}" "${HTTP_CODE}" >&2
sleep 10; continue ;;
*) printf 'Task %s: HTTP %s\n' "${PREDICTION_ID}" "${HTTP_CODE}" >&2
cat "${BODY_FILE}" >&2; exit 1 ;;
esac
RESULT=$(jq 'if type == "object" and has("data") then .data else . end' "${BODY_FILE}")
STATUS=$(printf '%s' "${RESULT}" | jq -r '.status // empty')
case "${STATUS}" in
completed) printf '%s\n' "${RESULT}" | jq '.outputs'; break ;;
failed|cancelled|timeout|deleted)
printf 'Task %s ended with status %s\n' "${PREDICTION_ID}" "${STATUS}" >&2
printf '%s\n' "${RESULT}" | jq . >&2; exit 1 ;;
*) sleep 2 ;;
esac
doneRetry temporary errors only while polling, never the submit request. Errors, retries and timeouts
Parameters
Task Submission Parameters
Request Parameters
| Parameter | Type | Required | Default | Range | Description |
|---|---|---|---|---|---|
| video | string | Yes | - | Source video URL (MP4, MOV or WebM) with a clearly visible face. Maximum file size: 200 MB. Only the first 60 seconds are used. Larger videos are scaled down to a maximum of 1920 pixels on the longest side, preserving the aspect ratio. | |
| audio | string | Yes | - | - | Audio URL (MP3, WAV, M4A or similar) with the replacement speech to lip-sync. Only the first 60 seconds are used. |
| seed | integer | No | - | - | Random seed for reproducible results. |
Every model also accepts the global request options enable_sync_mode and enable_base64_output; see their pages for details.
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | integer | HTTP status code (e.g., 200 for success) |
| message | string | Status message (e.g., “success”) |
| data.id | string | Unique identifier for the prediction, Task Id |
| data.model | string | Model ID used for the prediction |
| data.outputs | array | Output values, usually URL strings; some models return text strings or structured result objects (empty when status is not completed) |
| data.urls | object | Object containing related API endpoints |
| data.status | string | Task status. completed is successful; failed, cancelled, timeout, and deleted are failure terminal statuses. |
| data.created_at | string | ISO timestamp of when the request was created (e.g., “2023-04-01T12:34:56.789Z”) |
| data.error | string | Error message (empty if no error occurred) |
| data.timings | object | Object containing timing details |
| data.timings.inference | integer | Inference time in milliseconds |
Result Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| id | string | Yes | - | Task ID |
Result Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | integer | HTTP status code (e.g., 200 for success) |
| message | string | Status message (e.g., “success”) |
| data | object | The prediction data object containing all details |
| data.id | string | Unique identifier for the prediction |
| data.model | string | Model ID used for the prediction |
| data.outputs | array<string | object> | Array of generated outputs (empty when status is not completed). Items are usually URL strings, but may be text strings or structured result objects, depending on the model. |
| data.urls | object | Object containing related API endpoints |
| data.status | string | Status: completed is successful; failed, cancelled, timeout, and deleted are failure terminal statuses |
| data.created_at | string | ISO timestamp of when the request was created |
| data.error | string | Error message (empty if no error occurred) |
| data.timings | object | Object containing timing details |
| data.timings.inference | integer | Inference time in milliseconds |