unifi_protect_export_video
Export recorded UniFi Protect camera footage over a specified time range to an MP4 file on disk, returning the file path. Use it to save video clips for review; ensure the camera was recording during that period.
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.
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". 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". 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. |