export_camera_clip
Export a UniFi Protect recording clip as an MP4 file to a local path. Provide camera, start and end timestamps, and output destination.
Instructions
Export a UniFi Protect recording clip as an MP4 file written to local disk.
Mutating, file-writing operation: it resolves the camera (by id or name), fetches the recording for the requested time range, and writes an MP4 file into the server's confined export directory (the path is validated against that directory, so output_path must not escape it). Requires Protect username/password credentials configured for the console. The write is a no-op until confirm is set to true, at which point it returns the written file path and size in bytes. Use get_camera_snapshot for a single still image instead of a time-ranged clip.
Args: camera: Protect camera identifier or name to export footage from. start_ts: Clip start time as a Unix epoch timestamp (seconds). end_ts: Clip end time as a Unix epoch timestamp (seconds); must be after start_ts. output_path: Destination filename (or path relative to the export directory); it is confined to the server's export directory. device: Optional Protect console name to target a specific UniFi Protect device; omit to use the first Protect-enabled device. confirm: Safety confirmation required for this file-writing operation; the export returns a failure message until set to true.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| camera | Yes | Protect camera identifier or name to export footage from. | |
| device | No | Optional Protect console name to target a specific UniFi Protect device; omit to use the first Protect-enabled device. | |
| end_ts | Yes | Clip end time as a Unix epoch timestamp (seconds); must be after start_ts. | |
| confirm | No | Safety confirmation required for this file-writing operation; the export returns a failure message until set to true. | |
| start_ts | Yes | Clip start time as a Unix epoch timestamp (seconds). | |
| output_path | Yes | Destination filename (or path relative to the export directory); it is confined to the server's export directory. |