# Cameras

Fregata works with anything that exposes RTSP — which is almost
every IP camera made. This page is a cheat-sheet of URL patterns by
brand, plus the workarounds for cameras that are shy about their
streams.

## URL shapes by brand

Replace `user:pass` with your camera's credentials and `IP` with the
camera's address. The "main stream" is the high-resolution feed for
recording; the "sub-stream" is a lower-resolution feed for
detection.

### Reolink

```
Main:  rtsp://user:pass@IP:554/h264Preview_01_main
Sub:   rtsp://user:pass@IP:554/h264Preview_01_sub
```

For HEVC models, swap `h264` for `h265`. Most modern Reolinks dual-
encode — they'll serve H.264 even when set to H.265 in the app.

[Reolink on Amazon →](https://www.amazon.com/stores/REOLINK/page/201E3A4F-C63F-48A6-87B7-524F985330DA)

### Amcrest / Dahua

```
Main:  rtsp://user:pass@IP:554/cam/realmonitor?channel=1&subtype=0
Sub:   rtsp://user:pass@IP:554/cam/realmonitor?channel=1&subtype=1
```

Multi-channel NVRs from these brands increment the `channel`
parameter (1, 2, 3…). The sub-stream toggle is `subtype`.

[Amcrest on Amazon →](https://www.amazon.com/stores/Amcrest/page/2404E471-79FC-4D18-B767-8777D048264F)

[Dahua on Amazon →](https://www.amazon.com/s?k=dahua+ip+camera)

### Hikvision

```
Main:  rtsp://user:pass@IP:554/Streaming/Channels/101
Sub:   rtsp://user:pass@IP:554/Streaming/Channels/102
```

The path is `1xx` (main) and `1xy` (sub-stream); for additional
channels, increment the leading digit.

[Hikvision on Amazon →](https://www.amazon.com/s?k=hikvision+ip+camera)

### Lorex

Most Lorex models are rebadged Dahua. Try the Dahua URL first.

[Lorex on Amazon →](https://www.amazon.com/stores/page/11B83BFE-0C25-49FA-BF26-7D8C4049A6F9)

### Ubiquiti UniFi Protect

UniFi cameras have RTSP **disabled by default**. To turn it on:

1. Open Protect.
2. Cameras → click camera → **Settings** → **Advanced**.
3. Under **RTSP**, enable each stream you want and copy the URL.

The URL UniFi gives you looks like
`rtsps://192.168.1.1:7441/<random-key>` — it's RTSP-over-TLS, port
7441. Fregata handles `rtsps://`; just paste the URL as-is.

[Ubiquiti UniFi on Amazon →](https://www.amazon.com/s?k=unifi+protect+camera)

### Ring / Nest / Wyze (cloud-only)

These don't expose RTSP. Workarounds:

- **Ring** — no first-party path. Some users run [Wyze-Ring-RTSP](https://github.com/giladaya/wyze-ring-rtsp)-style proxies, but they're brittle.
- **Nest** — Google killed the SDM API for new accounts; legacy
  Nest cams have community projects but nothing reliable.
- **Wyze** — Wyze sells official RTSP firmware for some models. If
  yours is supported, install that firmware and it becomes a
  normal RTSP camera.

If "no cloud" matters to you, buy cameras that ship RTSP first-class:
[Reolink](https://www.amazon.com/stores/REOLINK/page/201E3A4F-C63F-48A6-87B7-524F985330DA), [Amcrest](https://www.amazon.com/stores/Amcrest/page/2404E471-79FC-4D18-B767-8777D048264F), [Dahua](https://www.amazon.com/s?k=dahua+ip+camera), [Hikvision](https://www.amazon.com/s?k=hikvision+ip+camera), [UniFi](https://www.amazon.com/s?k=unifi+protect+camera).

### Tapo / TP-Link

```
Main:  rtsp://user:pass@IP:554/stream1
Sub:   rtsp://user:pass@IP:554/stream2
```

Tapo cameras require you to **enable the camera account** in the
Tapo app first (Settings → Camera Account → Set Up). The
username/password you set there is what RTSP uses, separate from
your Tapo account credentials.

[Tapo on Amazon →](https://www.amazon.com/stores/Tapo/page/87EDF322-0937-412E-9707-0FD32A31EB77)

### Axis

```
rtsp://user:pass@IP/axis-media/media.amp
```

Axis URLs accept a `videocodec` query param if you want to pin the
codec. Without it, the camera serves whatever's negotiated.

[Axis on Amazon →](https://www.amazon.com/s?k=axis+ip+camera)

### Generic ONVIF

Cameras that follow the ONVIF spec (most of them) expose stream
URLs via the `Media2` service. The easiest discovery tool is
[ONVIF Device Manager](https://sourceforge.net/projects/onvifdm/),
which connects, lists profiles, and prints the RTSP URL for each.

## Webcams (USB or built-in iSight)

USB and built-in cameras don't speak RTSP. Two options:

1. **Run go2rtc** with a `ffmpeg:device` source to fan out a
   built-in or USB camera as RTSP. go2rtc is already part of
   Fregata's bundle; configure it via `go2rtc.streams` in
   `config.yml`. See
   [go2rtc's README](https://github.com/AlexxIT/go2rtc) for syntax.
2. **Plug in via Continuity Camera** — your iPhone's camera shows
   up as a webcam to macOS, which go2rtc can then serve. Useful
   for one-off "what does that camera angle look like" tests.

This isn't the use case Fregata's tuned for — single-purpose IP
cameras are the boring, reliable choice — but the mechanism works.

## Sub-streams: optional power saver

On Linux Frigate, the standard pattern is **main stream for
recording, sub-stream for detection** — sub-streams are usually
720P or lower, which keeps the CPU detection path tractable. On Fregata
you don't need this. The ANE handles inference at full resolution
and full FPS without breaking a sweat, and VideoToolbox decodes
the main stream nearly for free. The simpler config is the default:

```yaml
go2rtc:
  streams:
    driveway:
      - rtsp://user:pass@10.0.1.20:554/h264Preview_01_main

cameras:
  driveway:
    live:
      streams:
        Main: driveway        # must match the go2rtc.streams key above
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/driveway
          input_args: preset-rtsp-restream
          roles: [record, detect]
```

One stream in, one decode pass, both roles served from the same
buffer. The `go2rtc.streams` entry and the matching `live.streams` key
are required for MSE/WebRTC live tiles in the web UI — without them
the player silently falls back to low-quality jsmpeg. The camera wizard
adds both automatically; the above is what it produces for a single-stream camera.

There is still one narrow case where adding a sub-stream pays:

- **Network-constrained installs.** If the cameras share a
  congested Wi-Fi link with the Mac and packet loss is making
  RTSP brittle, a sub-stream halves the bytes-per-second per
  camera.

The sub-stream variant looks like this:

```yaml
go2rtc:
  streams:
    driveway:
      - rtsp://user:pass@10.0.1.20:554/h264Preview_01_main
    driveway_sub:
      - rtsp://user:pass@10.0.1.20:554/h264Preview_01_sub

cameras:
  driveway:
    live:
      streams:
        Main: driveway        # main stream for live view
        Sub: driveway_sub     # sub-stream also browsable
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/driveway
          input_args: preset-rtsp-restream
          roles: [record]
        - path: rtsp://127.0.0.1:8554/driveway_sub
          input_args: preset-rtsp-restream
          roles: [detect]
```

If your camera doesn't expose a separate sub-stream URL, the
single-stream default is what you want anyway.

## Forcing TCP transport

If detection is choppy and `ffprobe` shows the camera is reachable
over TCP but not UDP (a common Wi-Fi failure mode), pin the
transport:

```yaml
ffmpeg:
  input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1
```

This is also Fregata's default for most camera profiles — you
shouldn't need to set it unless you've overridden `input_args`
elsewhere.

## What about ONVIF auto-discovery?

Frigate has an `onvif` config block on each camera for PTZ control
and presets. It doesn't replace the RTSP URL — you still need that.
The ONVIF block is for telling Fregata "this camera's pan-tilt-
zoom is at port 8000, and here's how to authenticate". See
[the Frigate ONVIF docs](https://docs.frigate.video/configuration/autotracking)
for the details.

:::tip
When in doubt, test the URL with
`ffprobe -rtsp_transport tcp '<url>'` before you put it in
Fregata's config. If ffprobe can't open it, neither can Fregata.
:::
