Join media files end to end
concat_media_filesJoin two or more video or audio files into one output file in the order given, re-encoding mixed formats or copying identical formats without re-encoding.
Instructions
Join two or more media files into one new file, in the order given. mode "reencode" (default) works for any mix of sizes, frame rates and codecs: every file is scaled and padded to one frame size and frame rate (default: those of the first file), only the first audio stream of each file is used (stereo 48 kHz), files without sound get silence, still images last 5 s each, and the result is H.264 + AAC (.mp4/.mov/.mkv) or, for audio-only inputs, the container's default codec (24-bit PCM for .wav). mode "copy" joins without re-encoding and only works when all files have identical codecs, size, frame rate and audio format (for example segments from one camera). Mixing video files with audio-only files fails with BAD_ARGS. Returns the new file's duration and streams, file_count and sum_of_source_durations. To put clips one after another in a sequence use add_clips_sequentially instead. Works on the file on disk with ffmpeg, not on the timeline; Premiere Pro is not needed. ffmpeg and ffprobe must be installed (see check_ffmpeg), else FFMPEG_NOT_FOUND.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"paths": "<paths>",
"output_path": "<output_path>"
},
"name": "concat_media_files"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fps | No | Frame rate of the result in frames per second (reencode mode only). Default: the first file's frame rate (30 when it is a still). | |
| mode | No | "reencode" = normalise and encode (default; handles mixed formats). "copy" = no re-encoding, identical formats only. | |
| paths | Yes | Absolute paths of the 2-50 files to join, in order. Either all with video or all audio-only. | |
| width | No | Frame width of the result in pixels, rounded to even (reencode mode only). Default: the first file's width. | |
| height | No | Frame height of the result in pixels, rounded to even (reencode mode only). Default: the first file's height. | |
| overwrite | No | Replace output_path if it already exists. Default false: an existing file makes the tool fail with FILE_EXISTS. | |
| output_path | Yes | Absolute path of the file to write; must not be one of the inputs. The extension chooses the container. | |
| timeout_seconds | No | Stop ffmpeg and fail with TIMEOUT after this many seconds. Default 3600. |