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
| Parameter | Required | Description |
|---|---|---|
| video | Yes | The video to split, up to 600 seconds long. |
| sensitivity | No | low, medium or high. Default: medium. Use high when soft cuts are missed, low when fast motion is split into too many clips. |
| min_shot_seconds | No | Shortest clip to return, from 0.1 to 60 seconds. Default: 1. A shorter shot is joined to the one before it. |
How to Use
- Add a video — Upload a file or provide a URL.
- Adjust detection (optional) — Set
sensitivityandmin_shot_seconds. - Submit — Each shot is returned as its own clip in
outputs, in playing order. - Read the times (optional) —
details.outputslists thestartandendof each clip, in the same order.
Pricing
Pricing is based on the duration of the input video.
| Input Duration | Price |
|---|---|
| 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
sensitivityonly if shots are missed or over-split. - Raise
min_shot_secondsto 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
60clips are returned. If more shots are found, the request fails with a message asking for a lowersensitivityor a highermin_shot_seconds. - Clips are re-encoded as H.264 MP4 with AAC audio at the source resolution and frame rate.
Related Models
- 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
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 to split, up to 10 minutes long. | |
| sensitivity | string | No | medium | low, medium, high | How 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_seconds | number | No | 1 | 0.1 ~ 60 | Shortest 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
| 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.details | object | Optional. Additional information about the outputs, returned by some models; omitted otherwise |
| 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 |