Pass every clip as its own entry in inputs and join them in the output with the concat filter. Set n to the number of inputs and map the two labels it produces.
The ffmpeg command
What you would run locally, for reference.
ffmpeg -i first.mp4 -i second.mp4 \ -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[outv][outa]" \ -map "[outv]" -map "[outa]" \ output.mp4
The API request
The same flags, sent as JSON. Authenticate with
Authorization: Token <your-api-token>.
{
"global_options": [
"-y"
],
"inputs": [
{
"input_source": "https://example.com/first.mp4"
},
{
"input_source": "https://example.com/second.mp4"
}
],
"outputs": [
{
"filename": "output.mp4",
"options": [
"-filter_complex",
"[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[outv][outa]",
"-map",
"[outv]",
"-map",
"[outa]"
]
}
]
}
Worth knowing
- The concat filter is the way to do this here — the concat demuxer (
-f concat) reads a playlist file from disk and is rejected with a 400. - The filter re-encodes, so clips with different resolutions or frame rates join fine. Bump
nand add another[i:v:0][i:a:0]pair for each extra clip. - Every input needs an audio track. Joining a clip that has none makes the filter fail — give it a silent track first.
What it costs
Jobs bill in processing seconds — the CPU time this one actually uses — with a floor of 25 seconds per GB pulled out of storage to run it, so a stream-copy still counts. Uploading the output and downloading it afterwards are free. See the plans.