For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
StatusSupportDiscussionsLog inSign Up
Docs HomeAPI ReferenceVideo on DemandAI FeaturesLive StreamingVideo PlayerVideo DataCloud PlayoutRecipes
Docs HomeAPI ReferenceVideo on DemandAI FeaturesLive StreamingVideo PlayerVideo DataCloud PlayoutRecipes
  • Get started
    • Overview
    • Quickstart
  • Upload videos
    • Upload videos from device
    • Upload videos from a URL
    • Upload 4K videos
    • Speed up video processing
  • Playback and delivery
    • Play your videos
    • Embed a video in your app
    • Configure media quality levels
    • Enable MP4 Support for offline viewing
    • Create and manage playlists
  • Edit and transform videos
    • Add metadata to videos
    • Add a watermark to a video
    • Add an intro and outro to a video
    • Clip and trim videos
    • Merge and stitch videos
    • Remove unwanted video segments
  • Manage audio and subtitle tracks
    • Upload and play audio and subtitle tracks
    • Add subtitles to a video
    • Generate subtitles automatically
    • Add audio to a video
    • Replace a video's audio track
    • Normalize audio loudness
    • Overlay audio on a video timeline
  • Extract images from video
    • Create thumbnails from a video
    • Create GIFs from a video
    • Create timeline hovers from a video
  • Video security
    • Generate JWTs for secure media
    • Secure media access with JWTs
    • Restrict playback access
    • Set up DRM encryption
    • FairPlay DRM integration
  • VOD events
    • Media events
    • Transform media events
LogoLogo
StatusSupportDiscussionsLog inSign Up
On this page
  • Endpoint for stitching
  • Prepare your media files
  • Create a JSON request to stitch media
  • Create new media from URL
  • Create new media by direct upload (from device)
  • Stitch segments in existing media
  • Example response
  • Webhook event for status
Edit and transform videos

Merge and stitch videos

Learn to stitch multiple videos into one by merging base media with segments at defined timestamps or appending them at the end, and receive webhook updates for progress and completion.
Was this page helpful?
Previous

Remove unwanted video segments

Remove unwanted video segments and mistakes using FastPix editing tool for polished content.
Next
Built with

You can combine a base video with additional video segments (also called video splicing) by defining specific insert timestamps or appending them at the end. This programmatic approach is ideal for building dynamic, automated video workflows - like generating post-game highlight reels, assembling personalized video feeds, or combining pre-roll and mid-roll content into a single video.


Endpoint for stitching

To stitch videos together, you can use both the create media from URL or  upload media from device  API endpoints.

All requests must be authenticated using HTTP Basic Auth with your FastPix Access Token and Secret Key.
See basic authentication guide to get your credentials.


Prepare your media files

  1. Get the URLs for the following media files:
  • Base media: The main video URL or file (for device upload) where you want to merge other videos.
  • Media segments: Additional videos files already available in FastPix or in a public storage.

NOTE

  • The resolutions for video segments should be greater than or equal to the base video as FastPix does not support upscaling.
  • The frame rate of the video segments should be similar to the base video frame rate.


Create a JSON request to stitch media

To stitch a video, define the base media file in the url field and provide an array of segments inside the segments field. Each segment must be a separate media file.

Use insertAt for specific timestamps (in seconds), or insertAtEnd: true to append to the end of the base video.

FastPix processes the entire input and returns a new stitched video asset with a unique media ID and playback ID. The stitched media preserves all base media settings along with all segments added at their specified positions.

To stitch a media using a JSON request:

a. Create a new media from URL or directly upload it from the device.

b. Stitch segments in existing media


Create new media from URL

Request body
1{
2 "inputs": [
3 {
4 "type": "video",
5 "url": "https://static.fastpix.com/fp-sample-video.mp4",
6 "segments": [
7 {
8 "url": "https://static.fastpix.com/fp-sample-video.mp4",
9 "insertAt": 5
10 },
11 {
12 "url": "https://static.fastpix.com/fp-sample-video.mp4",
13 "insertAt": 8
14 },
15 {
16 "url": "https://static.fastpix.com/fp-sample-video.mp4",
17 "insertAtEnd": true
18 }
19 ]
20 }
21 ],
22 "metadata": {
23 "key1": "value1"
24 },
25 "accessPolicy": "public",
26 "maxResolution": "1080p"
27}

NOTE

  • You must specify either insertAt or insertAtEnd, but not both, for each segment.

  • Use the URL which is generated after uploading video to FastPix dashboard.


The resulting stitched media preserves all base media settings and then generates a new video with all segments added at their specified positions.


Create new media by direct upload (from device)

Request body
1{
2 "corsOrigin": "*",
3 "pushMediaSettings": {
4 "inputs": [
5 {
6 "segments": [
7 {
8 "url": "https://static.fastpix.com/fp-sample-video.mp4",
9 "insertAt": 5
10 },
11 {
12 "url": "https://static.fastpix.com/fp-sample-video.mp4",
13 "insertAtEnd": true
14 }
15 ]
16 }
17 ],
18 "accessPolicy": "public"
19 }
20}

Stitch segments in existing media

The process for stitching video segments from media uploaded from a device is similar to stitching segments from media created using a URL. The only difference is that instead of using a base video URL, you must use the mediaId of the existing media with the fp_mediaId:// prefix.


NOTE

A new media always gets created when video segments stitched to an existing media.


Request body
1{
2 "inputs": [
3 {
4 "type": "video",
5 "url": "fp_mediaId://7271d4de-e83c-431c-8aea-896c55f52645",
6 "segments": [
7 {
8 "url": "https://static.fastpix.com/fp-sample-video.mp4",
9 "insertAt": 5
10 },
11 {
12 "url": "https://static.fastpix.com/fp-sample-video.mp4",
13 "insertAt": 8
14 },
15 {
16 "url": "https://static.fastpix.com/fp-sample-video.mp4",
17 "insertAtEnd": true
18 }
19 ]
20 }
21 ],
22 "accessPolicy": "public"
23}

Example response

A successful request returns a stitched media asset with its own unique media ID and a list of playback IDs. You can now stream the new stitched video using the provided playback ID.


Response
1{
2 "success": true,
3 "data": {
4 "id": "c1010eb9-864b-42e8-998e-086eb5ebd5e8",
5 "sourceMediaId": "91ac0984-97a8-44cf-b89a-48c6b7be1c67",
6 "trial": false,
7 "status": "Created",
8 "createdAt": "2025-12-23T13:06:08.672278Z",
9 "updatedAt": "2025-12-23T13:06:08.672290Z",
10 "playbackIds": [
11 {
12 "id": "dcafc942-f1b5-4278-89d8-e49cda194dd1",
13 "accessPolicy": "public",
14 "accessRestrictions": {
15 "domains": {
16 "defaultPolicy": "allow",
17 "allow": [],
18 "deny": []
19 },
20 "userAgents": {
21 "defaultPolicy": "allow",
22 "allow": [],
23 "deny": []
24 }
25 }
26 }
27 ],
28 "mediaQuality": "standard",
29 "title": "91ac0984-97a8-44cf-b89a-48c6b7be1c67",
30 "sourceAccess": false,
31 "maxResolution": "1080p",
32 "inputs": [
33 {
34 "type": "video",
35 "url": "fp_mediaId://91ac0984-97a8-44cf-b89a-48c6b7be1c67",
36 "segments": [
37 {
38 "url": "https://static.fastpix.com/fp-sample-video.mp4",
39 "insertAt": 5
40 },
41 {
42 "url": "https://static.fastpix.com/fp-sample-video.mp4",
43 "insertAt": 8
44 },
45 {
46 "url": "https://static.fastpix.com/fp-sample-video.mp4",
47 "insertAtEnd": true
48 }
49 ]
50 }
51 ],
52 "optimizeAudio": false
53 }
54}

Webhook event for status

You can register a webhook to receive an event when stitching is complete. How to setup webhooks?

Event: video.media.splicing.ready


Sample webhook payload
1{
2 "type": "video.media.splicing.ready",
3 "object": {
4 "type": "media",
5 "id": "c1010eb9-864b-42e8-998e-086eb5ebd5e8"
6 },
7 "id": "b891bd97-21bd-456c-a1d3-843e2fc59a05",
8 "workspace": {
9 "name": "Test",
10 "id": "b7bea348-c6b0-4c7b-b25f-1cf3ee65e5c3"
11 },
12 "status": "ready",
13 "data": {
14 "thumbnail": "https://images.fastpix.com/dcafc942-f1b5-4278-89d8-e49cda194dd1/thumbnail.png",
15 "id": "c1010eb9-864b-42e8-998e-086eb5ebd5e8",
16 "workspaceId": "b7bea348-c6b0-4c7b-b25f-1cf3ee65e5c3",
17 "mediaQuality": "standard",
18 "maxResolution": "1080p",
19 "sourceResolution": "1080",
20 "sourceAccess": false,
21 "mp4Support": "none",
22 "optimizeAudio": false,
23 "duration": "00:00:40",
24 "aspectRatio": "16:9",
25 "createdAt": "2025-12-23T13:06:08.672278Z",
26 "updatedAt": "2025-12-23T13:07:25.045991Z"
27 },
28 "createdAt": "2025-12-23T13:07:25.101336483Z",
29 "attempts": []
30}