Video Splitter API Documentation

Video Splitter API Documentation

Playground

Try it on WaveSpeedAI!

Video Splitter cuts a video into its shots automatically: it finds every scene change and returns each shot as its own clip, in playing order, with each clip’s start and end time. Ready-to-use REST inference API, no coldstarts, affordable pricing.

Features

Video Splitter cuts one video into its shots. It finds every scene change automatically and returns each shot as a separate MP4, in playing order, together with each clip’s start and end time in the source video.

The input video can be up to 600 seconds long.


Why Choose This?

  • Automatic shot detection — No timestamps to prepare: cuts are found from the picture itself.
  • Frame-accurate clips — Every clip starts on the first frame of its shot and keeps its sound.
  • Nothing lost — The clips cover the whole video from start to end, with no gaps and no repeated frames.
  • Start and end times — The result lists where each clip sits in the source video.
  • Adjustable — Choose how sensitive detection is and how short a clip may be.

Parameters

ParameterRequiredDescription
videoYesThe video to split, up to 600 seconds long.
sensitivityNolow, medium or high. Default: medium. Use high when soft cuts are missed, low when fast motion is split into too many clips.
min_shot_secondsNoShortest clip to return, from 0.1 to 60 seconds. Default: 1. A shorter shot is joined to the one before it.

How to Use

  1. Add a video — Upload a file or provide a URL.
  2. Adjust detection (optional) — Set sensitivity and min_shot_seconds.
  3. Submit — Each shot is returned as its own clip in outputs, in playing order.
  4. Read the times (optional) — details.outputs lists the start and end of each clip, in the same order.

Pricing

Pricing is based on the duration of the input video.

Input DurationPrice
10s$0.002
30s$0.006
60s$0.012
300s$0.06
600s$0.12

The duration is rounded up to the next whole second, with a minimum of 3 seconds for billing. The number of clips returned does not change the price.


Best Use Cases

  • Re-editing — Break a finished video into its shots, then reorder or replace them.
  • Repurposing long videos — Turn one video into separate clips for short-form posts.
  • Shot-by-shot processing — Upscale, restyle or dub individual shots and join them again with Video Merger.
  • Review and logging — Get a list of shot times for a video.

Pro Tips

  • Start with the defaults; change sensitivity only if shots are missed or over-split.
  • Raise min_shot_seconds to avoid very short clips in fast-cut footage.
  • Hard cuts are detected most reliably. A slow dissolve may stay inside one clip.
  • Clips come back in playing order, so they can be passed to Video Merger as they are.

Notes

  • A video without any cut is returned as a single clip.
  • At most 60 clips are returned. If more shots are found, the request fails with a message asking for a lower sensitivity or a higher min_shot_seconds.
  • Clips are re-encoded as H.264 MP4 with AAC audio at the source resolution and frame rate.

  • Video Merger — Join clips into one video with crossfades or straight cuts.
  • Video Eraser — Remove selected objects or unwanted elements from video.

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",
  "sensitivity": "medium",
  "min_shot_seconds": 1
}
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-splitter" \
  -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 to split, up to 10 minutes long.
sensitivitystringNomediumlow, medium, highHow readily a change in the picture counts as a new shot. Use high for soft cuts that are missed, low when fast motion is split into too many clips.
min_shot_secondsnumberNo10.1 ~ 60Shortest clip to return, in seconds. A shorter shot is joined to the one before it.

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.detailsobjectOptional. Additional information about the outputs, returned by some models; omitted otherwise
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.