UniFi Protect: Export Video
unifi_protect_export_videoExport recorded footage from one UniFi Protect camera over a time range to an MP4 file on disk, then receive the saved file path for local use.
Instructions
Export recorded footage from one camera over a time range as an MP4 file on disk. Always writes to a file and returns the path — video is never returned inline. Size grows quickly with the window: expect tens of megabytes per minute at full quality, and the call fails rather than exhausting memory if the export exceeds UNIFI_PROTECT_MAX_DOWNLOAD_BYTES. Footage only exists if the camera was recording at the time, so check the recording mode before concluding that nothing happened. The file starts on the keyframe before start, so it runs a little long at the front: startsAt is when its first frame was recorded, which is what to line exports from several cameras up on. audio gives the sound track's length and sample rate, or null when the export has no sound.
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": {
"cameraId": "<cameraId>",
"start": "<start>",
"end": "<end>"
},
"name": "unifi_protect_export_video"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | Yes | End of the footage to export. Accepts ISO 8601 ("2026-08-29T22:00:00Z"), a relative expression ("2h ago", "30m", "7d"), or "now". Local times ("1am", "2026-08-30 01:00") are read in the console's own time zone. Converted to the millisecond epoch the console requires — do not pass Unix seconds, which would silently query 1970 and return nothing. | |
| start | Yes | Beginning of the footage to export. Accepts ISO 8601 ("2026-08-29T22:00:00Z"), a relative expression ("2h ago", "30m", "7d"), or "now". Local times ("1am", "2026-08-30 01:00") are read in the console's own time zone. Converted to the millisecond epoch the console requires — do not pass Unix seconds, which would silently query 1970 and return nothing. | |
| channel | No | Encoder channel: 0 is the high-quality stream, higher numbers are progressively lower bitrate. Use a higher channel to keep a long export manageable. | |
| cameraId | Yes | Camera id — the `id` from unifi_protect_list_cameras, a 24-character hex string. Not the camera's name and not its MAC address. | |
| savePath | No | Absolute path to write the MP4 to. Defaults to a timestamped file under UNIFI_PROTECT_SNAPSHOT_DIR. Parent directories are created. |