> ## Documentation Index
> Fetch the complete documentation index at: https://docs.altnautica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Video recording

> Record the drone's video on the ground station: on-demand captures, continuous segment recording, clips cut from the recording, the routes and the ados record commands.

The ground station can record the drone's video as it arrives, so a capture survives even when the operator's laptop or phone is not connected. There are two recorders, and they write to the same root, `/var/ados/recordings`.

| Recorder | Started by | Writes |
| - | - | - |
| On-demand capture | `ados record start` or `POST /api/v1/ground-station/recording/start` | One MP4 per capture, until you stop it. |
| Continuous recording | `video.recording.enabled: true` | One-minute fMP4 segments per stream, all the time, kept for `video.recording.retention`. |

Both write fragmented MP4, so whatever reached disk before a power cut is playable.

## On-demand capture

The capture taps the ground station's local video stream (`rtsp://127.0.0.1:8554/main`) and remuxes it to MP4 without transcoding.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
ados record start --hint field-test
ados record stop
ados record list
```

If the stream drops during a capture (an RTSP end of stream on a degrading link, for example), the capture continues in a new file. `stop` lists every file in order and how many times that happened.

### Routes

| Method | Path | Effect |
| - | - | - |
| POST | `/api/v1/ground-station/recording/start` | Start a capture. Body `{"filename_hint": "..."}` (optional; sanitised). Returns `{filename, started_at, path}`. |
| POST | `/api/v1/ground-station/recording/stop` | Stop it. Returns `{filename, stopped_at, duration_seconds, size_bytes, segments, interrupted_count}`. |
| GET | `/api/v1/ground-station/recording/list` | The captures on disk, newest first, each with `filename`, `size_bytes` and `mtime`, plus `recording` (a capture is in flight) and `current_filename`. |
| DELETE | `/api/v1/ground-station/recording/{segment}` | Delete one file from the recordings directory. |

| Status | Cause |
| - | - |
| 409 | `start` while a capture runs, or `stop` with none running. |
| 503 | ffmpeg missing, the recordings directory not writable, or the recorder could not start. |
| 507 | The volume is full. |

Errors use the body `{"detail": {"error": {"code", "message"}}}`.

`POST /api/video/record/start` and `/stop` are the same two calls on any profile, with no ground-station gate. On a drone they record its own camera.

## Continuous recording and clips

With `video.recording.enabled: true`, the ground station's media server records every stream continuously into `/var/ados/recordings/<stream>/`, one segment a minute, and deletes segments older than `video.recording.retention` (`24h` by default). The agent's storage janitor also reclaims space when the volume fills, because a high-bitrate day can fill it before the retention window ends.

The segments act as a pre-roll buffer: you can cut any window out of them after the fact.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
ados record list --path main
ados record clip --path main --start 2026-11-28T10:15:00Z --duration 30 -o clip.mp4
```

| Method | Path | Effect |
| - | - | - |
| GET | `/api/v1/ground-station/recording/segments?path=<stream>` | The recorded time spans for one stream. |
| GET | `/api/v1/ground-station/recording/clip?path=<stream>&start=<RFC 3339>&duration=<s>` | An fMP4 clip a browser `<video>` element plays directly, streamed. `duration` is above 0 and at most 3600 seconds. |

A stream name is letters, digits, `.`, `_` or `-`. A bad parameter is `400` with `E_INVALID_PATH`, `E_INVALID_START` or `E_INVALID_DURATION`. When the media server's playback service does not answer, the reply is `503` `E_PLAYBACK_UNAVAILABLE`.

The media server's playback port is bound to loopback only; these routes are the authenticated way in.

## Profile gate

Every `/api/v1/ground-station/recording/*` route answers `404` with `E_PROFILE_MISMATCH` on a node that is not a ground station. `ados record` reports that as a sentence rather than an error body.

## Configuration

| Key | Default | Meaning |
| - | - | - |
| `video.recording.enabled` | `false` | Continuous recording. |
| `video.recording.path` | `/var/ados/recordings` | Root of the continuous recording tree. |
| `video.recording.retention` | `24h` | How long continuous segments are kept. |

See [CLI reference](https://docs.altnautica.com/drone-agent/cli-reference.md) for every `ados record` option.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.