How-to Stitch/Concatenate Multiple Files
Before you start
This guide assumes that you understand the basics of making a Transcode API request. We recommend completing the Getting Started with Transcoding Media guide first.
Stitch/concatenate multiple files
This guide shows you how to use the Media Transcode API to stitch together multiple files in a sequence to a single output file. For example, when creating a video as part of an episode series, you can create a single media file from an introduction file, main content file, and outro file.
You can think of this like clips in a sequence in a non-linear editor's timeline:
Files that you concatenate should contain audio and video in a single file.
Examples
Stitching/concatenating content is specified in an array of inputs
. Files are assembled in the order they appear in the array. To match our editor example above, we'd specify our inputs as follows:
Using URLs
If your input is public, or you are using a pre-signed URL, you specify multiple files to be stitched like this:
{
"inputs": [
{
"source": "http://example.com/videos/intro.mp4"
},
{
"source": "http://example.com/videos/main_content.mp4"
},
{
"source": "http://example.com/videos/outro.mp4"
}
],
Using cloud storage
You can also stitch together content from your own cloud storage. This method requires you to configure a storage
block. See our guides on using your own cloud storage:
After you configure your storage
block, you specify it in your request like this:
{
"inputs": [
{
"source": {
"ref": "my-storage-bucket",
"filename": "intro.mp4"
}
},
{
"source": {
"ref": "my-storage-bucket",
"filename": "main_content.mp4"
}
},
{
"source": {
"ref": "my-storage-bucket",
"filename": "outro.mp4"
}
}
],
You might want to trim or shorten a media file and stitch files together using one API call. See the Trimming and Stitching guide for an example.
Updated about 2 months ago