Video Outpainter API Documentation
Playground
Try it on WaveSpeedAI!Video Outpainter extends a video beyond its frame: the original picture stays exactly as it is and matching surroundings are generated around it, for aspect-ratio changes or a zoom-out without cropping. Ready-to-use REST inference API, best performance, no coldstarts, affordable pricing.
Features
Video Outpainter extends a video beyond its frame. It keeps the original picture exactly as it is and generates new, matching surroundings around it, so you can change the aspect ratio (for example 9:16 to 16:9, or 16:9 to 9:16) or zoom out without cropping anything.
Why Choose This?
-
The original stays untouched Only the new area is generated. The source picture is placed back into the result as it was.
-
Any direction, any ratio Widen a vertical clip, heighten a horizontal one, or zoom out on all sides.
-
Follows the motion The new surroundings move with the camera and the scene, including fast motion.
-
Optional prompt Leave it empty for a natural continuation, or describe what the new area should show.
-
Three output resolutions
480p,720p, or1080p. -
Audio preserved The source audio track is carried over.
Parameters
| Parameter | Required | Description |
|---|---|---|
| video | Yes | Input video URL or uploaded video. Up to 120 seconds is processed. |
| prompt | No | What the newly generated area should show. Describe only the new area, not the whole scene. |
| aspect_ratio | No | Output aspect ratio: auto, 1:1, 4:3, 3:4, 16:9, 9:16, 3:2, 2:3, 21:9, 9:21. Default: auto. |
| target_resolution | No | Output resolution: 480p, 720p, or 1080p. Default: 720p. |
| seed | No | Random seed for reproducible results. |
How aspect_ratio works
auto, or a ratio close to the source’s: the picture is zoomed out, and new content is generated on all four sides.- A clearly different ratio: the source fills the frame along one side, and the other direction is extended.
How to Use
- Upload a video — Provide the clip to extend.
- Choose the aspect ratio — Or keep
autoto zoom out. - Add a prompt (optional) — Describe the new surroundings if you want something specific.
- Choose target resolution and submit — Download the extended video.
Pricing
Pricing is based on input video duration and selected target_resolution.
Billed duration is rounded up to the next whole second, with a minimum billed duration of 3 seconds and a maximum billed duration of 120 seconds.
| Output Resolution | Per 5s | Per second |
|---|---|---|
| 480p | $0.10 | $0.02 |
| 720p | $0.20 | $0.04 |
| 1080p | $0.50 | $0.10 |
prompt, aspect_ratio and seed do not add separate charges.
Best Use Cases
- Reformatting for platforms — Turn one master shot into vertical, square, and widescreen versions without cropping.
- Adding room around a subject — Zoom out a shot that was framed too tight.
- Cinematic widescreen — Extend 16:9 footage to 21:9.
- Editing margins — Add space for titles, captions, or picture-in-picture.
Pro Tips
- With an empty prompt the model continues what is already in the frame, which is the most reliable choice.
- When you write a prompt, describe only the new area. Naming things that are already visible can duplicate them.
- Large extensions (for example 16:9 to 9:16) invent more of the scene than small ones. Try a different seed if the new area is not what you want.
- Choose the
target_resolutionclosest to your source for the sharpest result.
Limits and Performance
- Maximum processed video length per job:
120seconds. - Processing takes longer than real time and grows with resolution and length.
Related Models
- Video Background Remover Pro — Cut out a subject with soft edges.
- Video Cleaner — Remove people and moving objects.
- Video Relighter — Change the lighting of a shot.
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",
"aspect_ratio": "auto",
"target_resolution": "720p"
}
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/wavespeed-ai/video-outpainter" \
-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 | - | The video for generating the output. | |
| prompt | string | No | - | The positive prompt for the generation. | |
| aspect_ratio | string | No | auto | auto, 1:1, 4:3, 3:4, 16:9, 9:16, 3:2, 2:3, 21:9, 9:21 | The aspect ratio of the generated media. |
| target_resolution | string | No | 720p | 480p, 720p, 1080p | Output resolution (the pixel budget of the extended frame at the chosen aspect ratio). |
| seed | integer | No | - | - | The random seed to use for the generation. -1 means a random seed will be used. |
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 |