Skip to content

Concat / Merge Files

The concat recipe merges two or more media files into a single output using FFmpeg’s concat demuxer with stream copy (-c copy). This is fast because it doesn’t re-encode — it just joins the files end to end.

Merge two MP3 files:

Terminal window
curl -X POST https://api.xora.sh/v1/jobs \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"mode": "recipe",
"input_files": {
"in_1": "https://example.com/part1.mp3",
"in_2": "https://example.com/part2.mp3"
},
"output": {
"format": "mp3"
},
"recipe": {
"name": "concat"
}
}'
{
"jobId": "01JXYZ1234ABCDEF56789000",
"state": "queued"
}
ParameterTypeRequiredDescription
namestringYesMust be "concat"

The concat recipe uses input_files instead of input. This is the only recipe that works this way:

KeyPatternExample
in_1First file"https://example.com/part1.mp4"
in_2Second file"https://example.com/part2.mp4"
in_3Third file (optional)"https://example.com/part3.mp4"
More filesAs many as needed

Keys must follow the pattern in_ followed by letters, numbers, or underscores. You need at least two entries.

Join two MP4 clips:

{
"mode": "recipe",
"input_files": {
"in_1": "https://example.com/intro.mp4",
"in_2": "https://example.com/main.mp4"
},
"output": { "format": "mp4" },
"recipe": { "name": "concat" }
}
{
"mode": "recipe",
"input_files": {
"in_1": "https://example.com/chapter1.mp3",
"in_2": "https://example.com/chapter2.mp3",
"in_3": "https://example.com/chapter3.mp3"
},
"output": { "format": "mp3" },
"recipe": { "name": "concat" }
}

You can merge as many files as needed:

{
"mode": "recipe",
"input_files": {
"in_part_a": "https://example.com/a.mp4",
"in_part_b": "https://example.com/b.mp4",
"in_part_c": "https://example.com/c.mp4",
"in_part_d": "https://example.com/d.mp4",
"in_part_e": "https://example.com/e.mp4"
},
"output": { "format": "mp4" },
"recipe": { "name": "concat" }
}
FormatType
mp4Video
webmVideo
movVideo
mp3Audio
aacAudio
wavAudio

The concat recipe uses FFmpeg’s concat demuxer with stream copy (-c copy). This means:

  • No re-encoding — files are joined as-is, preserving original quality
  • Very fast — processing time is minimal regardless of file size
  • Inputs must be compatible — same codec, sample rate, and format
ProblemCauseFix
”codec mismatch” errorInput files use different codecsTranscode all inputs to the same format first
Audio out of syncDifferent sample ratesEnsure all audio tracks use the same sample rate
Only 1 input_files entryNeed at least 2Add a second file
Used input instead of input_filesWrong fieldRemove input, use input_files with in_1, in_2, etc.