Video Piper APIv1 Home OpenAPI spec

Docs › Trim, stitch & splice

Trim, stitch & splice

An edit makes a new video from clips of your finished videos (status SUCCEEDED). Send POST /videos with an edit instead of a file. There's nothing to upload (unless you add music or a voice-over or image overlays); poll the new video's status as usual.

Clip fieldDescription
videoIdOne of your finished videos. The same video may appear several times.
start, endSeconds into that video (default: all of it).
transitionHow the clip starts from the previous one: omitted = hard cut; {"type": "fade" | "fadeblack", "seconds": 0.1–3}.
volumeThe clip's own sound, 0–2: 1 as recorded (the default), 0 mutes it (for example under music), 2 twice as loud.

Also accepted: fileName, maxHeight, redactions and overlays (both on the edit's own timeline). Up to 50 clips. The first clip sets the frame size; differently shaped clips are letterboxed.

Recipes

// Cut 1:00–1:30 out of a video
{ "edit": { "clips": [ { "videoId": "AAAA…", "end": 60 }, { "videoId": "AAAA…", "start": 90 } ] } }

// Stitch an intro, a lesson and an outro, with soft joins
{ "fileName": "Lesson 1", "edit": { "clips": [
  { "videoId": "INTRO…" },
  { "videoId": "LESSON…", "transition": { "type": "fade", "seconds": 0.75 } },
  { "videoId": "OUTRO…",  "transition": { "type": "fadeblack", "seconds": 1 } } ] } }

// Splice a clip into another at 2:00
{ "edit": { "clips": [
  { "videoId": "MAIN…", "end": 120 },
  { "videoId": "INSERT…", "transition": { "type": "fadeblack", "seconds": 0.5 } },
  { "videoId": "MAIN…", "start": 120, "transition": { "type": "fadeblack", "seconds": 0.5 } } ] } }
201 Created
{ "videoId": "9a8b…", "status": "SUBMITTED", "clips": 3, "statusPath": "/videos/9a8b…" }

A clip from someone else's video gets 404 NOT_FOUND; a video still processing gets 409 EDIT_SOURCE_NOT_READY. To trim a new upload, use the trim option on complete instead: it's faster.

Music and voice-over tracks

Add audio to the edit to mix up to four audio files of your own over the clips: background music, a narration recorded separately, a sound effect. Any format FFmpeg reads works (MP3, AAC/M4A, WAV, FLAC, OGG…), up to 200 MB a file, on every plan and in test mode. Each clip keeps its own sound at its volume, so mute the clips ("volume": 0) for a voice-over, or keep them and lay a quiet song underneath.

Track fieldDescription
fileName, sizeBytesRequired: the file you'll upload next (name 1–200 characters; size up to 209,715,200 bytes).
atSeconds on the edit's timeline where the track starts (default 0; before the edit ends).
start, endThe part of the file to use, in seconds (default: all of it; end at least 0.1 s after start).
volume0–2; 1 as in the file, 0.4 quiet music under speech.
fadeIn, fadeOutSeconds of fade at each end, 0–10. The fade-out ends where the track stops, which is where the video ends if it was cut there.
loopRepeat the chosen part until the video ends (the part must be at most 10 minutes long).
duckLower the track while the clips have sound, so speech in the clips stays clear over the music; it comes back between sentences.

A track is cut where the video ends. With audio the edit is created like an upload: the answer is UPLOADING and names each file (audio[0], audio[1]…) with its part count. Upload every file the way you upload a video, with that name as file in the parts request, then call complete with an empty body: the edit's options (maxHeight, redactions, captions…) were given when it was created, and a field here is a 400.

// Music under a stitched video: a quiet song that loops as long as the video, ducks under the speech and fades out
POST /videos
{ "fileName": "Lesson 1 (with music)",
  "edit": { "clips": [ { "videoId": "INTRO…" }, { "videoId": "LESSON…", "transition": { "type": "fade" } } ],
            "audio": [ { "fileName": "song.mp3", "sizeBytes": 4300000, "volume": 0.4, "loop": true, "duck": true, "fadeOut": 3 } ] } }

201 Created
{ "videoId": "9a8b…", "status": "UPLOADING", "clips": 2, "partSize": 67108864,
  "audio": [ { "file": "audio[0]", "fileName": "song.mp3", "partSize": 67108864, "partCount": 1 } ], "statusPath": "/videos/9a8b…" }

POST /videos/9a8b…/parts
{ "file": "audio[0]", "partNumbers": [1] }
→ PUT each part's url with the bytes of song.mp3 (no Authorization header)

POST /videos/9a8b…/complete
{}
202 Accepted
{ "videoId": "9a8b…", "status": "SUBMITTED", "statusPath": "/videos/9a8b…", "executionArn": "…" }

// Voice-over over muted clips: the narration starts 2 s in and uses the first 90 s of the file
{ "edit": { "clips": [ { "videoId": "DEMO…", "volume": 0 }, { "videoId": "DEMO2…", "volume": 0 } ],
            "audio": [ { "fileName": "narration.wav", "sizeBytes": 15800000, "at": 2, "end": 90, "fadeIn": 0.5 } ] } }
  • How it's mixed: the tracks are mixed with the clips in the same pass that renders the timeline (volume, fades, looping, placement, ducking by a sidechain compressor, then one mix with a limiter so nothing clips), and the result is encoded like any upload. Captions transcribe the finished mix, music included.
  • Before complete: the status is UPLOADING; POST /videos/{id}/abort discards the files and the edit, and an edit whose files never arrive is deleted after 2 days. ?dryRun=true answers the tracks as they will apply, with each file's part count.
  • Status echoes edit.audio (each track's settings, never where the file is stored) and list items carry audioTracks. A reprocess keeps the files: nothing to upload again (409 UPLOAD_INCOMPLETE if they never arrived).
  • Refused up front (400, with the field in details): more than 4 tracks, a file over 200 MB, an at past the end of the edit, a volume or fade out of range. A file with no sound in it, or a start past its end, can only be seen when it's read, and ends the video FAILED. Edit tokens can't add audio (403 EDIT_TOKEN_SCOPE): make the edit from your server with your key.