Video Outpainter API Documentation

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, or 1080p.

  • Audio preserved The source audio track is carried over.


Parameters

ParameterRequiredDescription
videoYesInput video URL or uploaded video. Up to 120 seconds is processed.
promptNoWhat the newly generated area should show. Describe only the new area, not the whole scene.
aspect_ratioNoOutput aspect ratio: auto, 1:1, 4:3, 3:4, 16:9, 9:16, 3:2, 2:3, 21:9, 9:21. Default: auto.
target_resolutionNoOutput resolution: 480p, 720p, or 1080p. Default: 720p.
seedNoRandom 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

  1. Upload a video — Provide the clip to extend.
  2. Choose the aspect ratio — Or keep auto to zoom out.
  3. Add a prompt (optional) — Describe the new surroundings if you want something specific.
  4. 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 ResolutionPer 5sPer 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_resolution closest to your source for the sharpest result.

Limits and Performance

  • Maximum processed video length per job: 120 seconds.
  • Processing takes longer than real time and grows with resolution and length.

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
done

Retry temporary errors only while polling, never the submit request. Errors, retries and timeouts

Parameters

Task Submission Parameters

Request Parameters

ParameterTypeRequiredDefaultRangeDescription
videostringYes-The video for generating the output.
promptstringNo-The positive prompt for the generation.
aspect_ratiostringNoautoauto, 1:1, 4:3, 3:4, 16:9, 9:16, 3:2, 2:3, 21:9, 9:21The aspect ratio of the generated media.
target_resolutionstringNo720p480p, 720p, 1080pOutput resolution (the pixel budget of the extended frame at the chosen aspect ratio).
seedintegerNo--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

ParameterTypeDescription
codeintegerHTTP status code (e.g., 200 for success)
messagestringStatus message (e.g., “success”)
data.idstringUnique identifier for the prediction, Task Id
data.modelstringModel ID used for the prediction
data.outputsarrayOutput values, usually URL strings; some models return text strings or structured result objects (empty when status is not completed)
data.urlsobjectObject containing related API endpoints
data.statusstringTask status. completed is successful; failed, cancelled, timeout, and deleted are failure terminal statuses.
data.created_atstringISO timestamp of when the request was created (e.g., “2023-04-01T12:34:56.789Z”)
data.errorstringError message (empty if no error occurred)
data.timingsobjectObject containing timing details
data.timings.inferenceintegerInference time in milliseconds

Result Request Parameters

ParameterTypeRequiredDefaultDescription
idstringYes-Task ID

Result Response Parameters

ParameterTypeDescription
codeintegerHTTP status code (e.g., 200 for success)
messagestringStatus message (e.g., “success”)
dataobjectThe prediction data object containing all details
data.idstringUnique identifier for the prediction
data.modelstringModel ID used for the prediction
data.outputsarray<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.urlsobjectObject containing related API endpoints
data.statusstringStatus: completed is successful; failed, cancelled, timeout, and deleted are failure terminal statuses
data.created_atstringISO timestamp of when the request was created
data.errorstringError message (empty if no error occurred)
data.timingsobjectObject containing timing details
data.timings.inferenceintegerInference time in milliseconds
© 2026 WaveSpeedAI. All rights reserved.