Connect camera feeds and MQTT to Frigate

Connect an RTSP camera or a looped test feed and a Mosquitto MQTT broker to Frigate on a Raspberry Pi 5, then add each Frigate project’s camera and listener to one shared config.

Works with

AI HAT+Product overviewonRaspberry Pi 5

How it works

Every Frigate project here uses the same 2 inputs: an RTSP camera stream for Frigate to watch and an MQTT broker for Frigate to report on. You set them up once for all projects. Boxes like the ones in Figure 1 mean the stream and the detector both work.

With a real camera, Frigate reads the camera’s own RTSP address. Without one, a looped recording tests the full detection pipeline: a systemd service (a background program run by systemd, the Linux service manager) on a second computer plays the video in a loop with FFmpeg and publishes it through MediaMTX, the RTSP server in this setup.

  1. On the stream host, an FFmpeg feed service publishes the looped video to MediaMTX, which serves it over RTSP on port 8554.
  2. Frigate on the Raspberry Pi 5 reads the RTSP stream, and the DEEPX NPU runs the detection model.
  3. Whenever a tracked object appears, changes or ends, Frigate publishes a JSON message to frigate/events on the Mosquitto broker, port 1883.
  4. Python listener services on the Raspberry Pi 5 subscribe to that topic, act on the events they care about and publish their own alerts.

Each project adds only its own pieces: a camera, sometimes a model or a zone, and sometimes a listener. Its config fragment is a small YAML file with those pieces, and a merge script folds each fragment into one shared config.yaml instead of keeping one file per project.

Requirements

Finish these pages first, in order: the AI HAT+ quickstart, then set up Frigate with the DEEPX NPU.

Required

Hardware

  • Raspberry Pi 5 with the Sixfab AI HAT+ (DEEPX DX-M1M)Runs Frigate and the listeners. Tested on a Raspberry Pi 5 (8 GB) with Raspberry Pi OS Trixie (64-bit); last tested October 5, 2026.Shop
  • Camera inputAn RTSP camera or stream, at [RTSP_URL]. Tested with a live IP camera over RTSP.
  • Stream hostOptionalOnly for test feeds: an always-on computer on your network that runs the feed services. Tested on an ALPON X4 edge computer on the same network.
  • Broker hostAn always-on computer on your network that runs Mosquitto. Tested on the same ALPON X4 as the stream host, port 1883.

Software

  • Mosquitto and its clientsmosquitto and mosquitto-clients from the OS package repository; version not recorded.
  • MediaMTXv1.21.1, linux arm64 build; the archive ships with the project releases.
  • FFmpegInstalled at /usr/bin/ffmpeg; version not recorded.
  • Python 3 with venv supportThe listener installers put paho-mqtt into a virtual environment with pip; version not recorded.
  • The project repositorygit clone https://github.com/sixfab/sixfab-dx-frigate, then work from [REPO_DIR]. The feed units come from each project’s GitHub release.

DEEPX support is not in a stable Frigate release

DEEPX support was merged into Frigate’s dev branch on September 21, 2026 (PR #24336) and is not in a stable release yet; the latest stable release is v0.18.0 (September 12, 2026). Sixfab develops and maintains DEEPX support in Frigate (Frigate’s DEEPX NPU detector docs).

Use the image ghcr.io/blakeblackshear/frigate:af0ba19-standard-arm64 from GitHub Container Registry: Frigate’s own build of commit af0ba19 on the dev branch of the official Frigate repository, not a Sixfab-compiled image on Docker Hub. It is MIT licensed.

Install

Set up broker and RTSP server

Run on [STREAM_HOST], which in this setup is also [BROKER_HOST]. Mosquitto gives an MQTT broker on port 1883 and MediaMTX an RTSP server on port 8554.

  1. Install Mosquitto

    sudo apt-get update -qq && sudo apt-get install -y -qq mosquitto mosquitto-clients
  2. Create broker config

    Save these 2 lines as local.conf. The broker then listens on port 1883 on every interface and accepts anonymous clients:

    listener 1883 0.0.0.0
    allow_anonymous true
  3. Install config and start Mosquitto

    sudo mkdir -p /etc/mosquitto/conf.d
    sudo cp local.conf /etc/mosquitto/conf.d/local.conf
    sudo systemctl enable --now mosquitto
    sudo systemctl restart mosquitto

    The broker has no password. Keep it on a trusted local network; see Privacy.

  4. Install MediaMTX

    Install the MediaMTX binary (v1.21.1, linux arm64 in the tested setup) and its mediamtx.yml, then run it as a mediamtx systemd service and enable it. MediaMTX listens for RTSP on port 8554 (rtspAddress: :8554 in mediamtx.yml).

Both services report active (running) and enabled (Figure 2). The mediamtx log lines show RTSP sessions opening, so the feed server is taking connections.

Choose camera input

Check the stream from the Raspberry Pi 5 before you edit the Frigate config. If ffprobe reports the stream (Figure 3), Frigate can read the same address:

ffprobe [RTSP_URL]

Connect Frigate to broker

Run on the Raspberry Pi 5. Add one mqtt block to [FRIGATE_CONFIG_DIR]/config.yaml, once for all projects. The deployed config used these keys:

mqtt:
  enabled: true
  host: [BROKER_HOST]
  port: 1883
  topic_prefix: frigate

Add project’s camera to shared config

Run on the Raspberry Pi 5. Every project ships a config/fragment.yaml with its camera and, for projects with their own model, a models entry. Each listener is a Python script that subscribes to Frigate’s MQTT messages and keeps the broker address in a BROKER constant at the top of the script.

The merge rules:

  • Top-level settings from the fragment win, and nested dictionaries merge recursively.
  • models entries match by path. The same path replaces the entry; a new path is appended, so a rerun adds no duplicates.
  • cameras merge key by key. A camera with the same name is replaced, and other cameras stay untouched.
  • The script rewrites config.yaml with a YAML library, which drops any comments in the file. Keep your own notes elsewhere.

Restart Frigate, then confirm a live image in the Frigate UI at https://[PI_IP]:8971:

docker restart frigate

User-level services stop at logout. To start the listener at boot without a login, run this once; it asks for your password:

sudo loginctl enable-linger $USER

Verify

Run each check on the host the table names. Open Frigate in a browser only at https://[PI_IP]:8971, the authenticated port: Frigate treats port 5000 as unauthenticated, admin-level access.

#CheckRun onCommandExpected
1Feed reachableRaspberry Pi 5ffprobe [RTSP_URL]Stream details for the feed
2Broker running[BROKER_HOST]systemctl status mosquittoactive (running)
3Feed service running[STREAM_HOST]systemctl status [FEED_SERVICE]active (running)
4Frigate statsRaspberry Pi 5docker exec frigate curl -s http://localhost:5000/api/statsA JSON stats response from Frigate
5Frigate eventsAny computer that reaches the brokermosquitto_sub -h [BROKER_HOST] -t frigate/events -vOne JSON message each time Frigate tracks an object
6Listener alertsAny computer that reaches the brokermosquitto_sub -h [BROKER_HOST] -t [ALERT_TOPIC] -v, with the topic from Listener alert topicsOne JSON message each time the project’s listener fires

For Porch Pirate, check 6 is:

mosquitto_sub -h [BROKER_HOST] -t porch_pirate/theft_alert -v

If no alert arrives, see Troubleshooting.

Details

Tested layout

In the tested setup the feed and the broker ran on a second computer:

Stream host (any RTSP source)                Raspberry Pi 5 (Sixfab AI HAT+)
+------------------------------------+       +-----------------------------------+
| looped video -> FFmpeg (systemd)   |       | Frigate NVR                       |
| MediaMTX RTSP server, port 8554    |------>|   cameras read rtsp://...:8554/.. |
| Mosquitto broker, port 1883        |<----->|   publishes frigate/events        |
|                                    |       | Listener services (Python)        |
+------------------------------------+       +-----------------------------------+

Frigate event messages

Frigate publishes one JSON message on frigate/events for each change to a tracked object (Frigate MQTT docs), not one per detected object. The Boss Detector, squirrel and Porch Pirate listeners read these fields:

FieldUsed for
typenew, update or end. Boss Detector acts on new and update, the squirrel listener acts on the first new, and Porch Pirate also watches end
after.labelThe object class, such as person
after.cameraThe Frigate camera name
after.idThe tracked object ID, used by the squirrel and Porch Pirate listeners to follow one object
after.top_score or after.scoreThe detection score, compared with a minimum

Boss Detector and the squirrel listener add a per-camera cooldown, so a repeat sighting within the cooldown window does not fire again. Boss Detector’s cooldown is 5 s. The bird camera needs no listener: Frigate publishes one topic per species, frigate/birdfeeder/[SPECIES], and frigate/birdfeeder/all counts every bird in view.

To print events as formatted JSON (Figure 5), pipe the subscription through jq. Leave out -v: it adds the topic name in front of each message, and jq then cannot read it.

mosquitto_sub -h [BROKER_HOST] -t frigate/events | jq

Listener alert topics

Each listener publishes its own alert as JSON:

ProjectTopicFieldsPublished when
Boss Detectorboss_detector/alertcamera, score, timestampA person is detected, at most once every 5 s per camera
Squirrel sprinklersquirrel_sprinkler/triggercamera, score, timestampA squirrel is detected
Porch Pirateporch_pirate/theft_alertcamera, box_id, suspect_person_id, dropped_by, dropped_score, timestampporch_watch.py suspects a theft: an unrelated person appeared before a package disappeared

The Porch Pirate fields are the camera, the package ID, the suspect’s track ID, the track IDs of the people seen dropping the package, the score and a timestamp.

What each project adds to the shared config

All projects share one Frigate container, one broker and one NPU (the DEEPX DX-M1M on the Sixfab AI HAT+ in the tested setup). A project’s install adds its pieces to config.yaml and does not replace the file. A .dxnn file is a model compiled for the DEEPX NPU, and COCO-80 is the standard set of 80 COCO object classes that many pretrained YOLO models detect.

ProjectWhat its fragment adds
Boss DetectorA camera on the porch feed and the yolov8n-ppu-coco80.dxnn model in the indoor_thermal scene
Porch PirateThe porchpirate camera, the people-and-cardboxes.dxnn model in the indoor scene and a zone polygon
Squirrel detectionThe garden camera and the squirrel-detector-model.dxnn model in the outdoor scene
Face recognitionThe frontdoor camera, a models entry in the all scene and face recognition settings. Upstream Frigate lists AVX support as a requirement for face recognition, but it ran effectively on the Raspberry Pi 5
Bird camera species IDThe birdfeeder camera and the nabirds-new-model.dxnn model (555 species classes) in the outdoor_thermal scene
  • Frigate’s scene setting takes one of 5 values: all, indoor, outdoor, indoor_thermal and outdoor_thermal. Boss Detector uses indoor_thermal without a thermal camera, because it only needs an unused slot. The Frigate setup page explains how one DEEPX NPU runs several cameras and models.
  • One RTSP feed can serve more than one Frigate camera: Boss Detector’s camera and Porch Pirate’s camera are both configured for the porch path. Running both at the same time was not recorded.
  • Porch Pirate’s listener does not filter by camera, and Boss Detector’s listener alerts for people on every camera. The face recognition and Porch Pirate fragments both define a zone named frontdoor_zone, so if both projects share one Frigate, a person at the face camera can trigger a false theft alert. Rename one of the zones.

Terms

  • RTSP (Real Time Streaming Protocol) is how a camera or video server streams video over the network, at an address such as rtsp://[STREAM_HOST]:8554/[STREAM_PATH].
  • MQTT is a publish and subscribe messaging protocol. Frigate’s MQTT messages carry its events to your scripts.
  • A broker, such as Mosquitto, is the server that passes each message to the programs subscribed to it.
  • A topic is a message’s address on the broker, such as frigate/events.
  • The DEEPX NPU (neural processing unit) is the chip on the Sixfab AI HAT+ that runs the detection model.

Limitations

  • The tested setup ran the feeds and the broker on a second computer, with the scripts written for that two-machine layout. A Raspberry Pi 5 as stream or broker host is untested.
  • The Mosquitto broker has no password and no TLS; a password setup was not tested.
  • A looped recording tests the pipeline, not detection on a live scene.
  • The listeners store the broker address in the script, so they lose the broker if DHCP gives the broker host a new IP address.
  • The Boss Detector and squirrel listeners publish a placeholder alert to MQTT and write a log line. The real action, such as a sound or a sprinkler valve, is not wired in.
  • Home Assistant is not tested with these projects.
  • Frigate chooses the DX-RT version its DEEPX detector uses. The tested build pins DX-RT v3.4.0, and this setup cannot change it.

Privacy

These cameras can record people, so treat the video and the messages as personal data. Point cameras only at property you control, and tell people who enter the view that they are recorded.

Any device on your network that can reach the feed host or the broker can read your streams and messages, because neither service in this setup asks for credentials:

  • The Mosquitto config sets allow_anonymous true, and the listeners connect without a username or password.
  • MediaMTX’s default config allows the user any, with no password and no IP limit, to publish, read and play back every path.
  • Frigate’s own MQTT topics, including its command topics, are on the same anonymous broker, so anyone who can reach it can also publish to them.
  • Neither the feed server nor the broker uses TLS. Keep both services on a trusted local network and do not forward ports 1883 or 8554 to the internet.

Troubleshooting

Cause

Frigate cannot read the stream.

Fix

Run ffprobe [RTSP_URL] on the Raspberry Pi 5. If it fails, run systemctl status [FEED_SERVICE] on [STREAM_HOST].

Cause

The Mosquitto broker is not running or not reachable. A listener that cannot connect logs MQTT connection error, rc=<code>.

Fix

Run systemctl status mosquitto on [BROKER_HOST].

Cause

The listener service has stopped, Frigate publishes no events, or nothing the listener watches is on camera.

Fix

Check that the listener runs. A running service reports active (running), and at start it logs Connected to broker ([BROKER_HOST]:1883), listening on frigate/events:

systemctl --user status [LISTENER_SERVICE] --no-pager -n 30

Then confirm that Frigate publishes with mosquitto_sub -h [BROKER_HOST] -t frigate/events -v, and that a person, squirrel or package is actually on camera.

Cause

The listener holds a stale broker address in the BROKER constant of its installed script. The repository scripts carry the comment “can change via DHCP, verify first”.

Fix

Re-run the project’s install.sh with BROKER=[BROKER_HOST] to write the current address, or edit the constant and restart the service.

Cause

User-level services stop at logout unless linger is on.

Fix

Run sudo loginctl enable-linger $USER once.

Cause

The merged config is invalid; Frigate reports it as Config Validation Errors.

Fix

The install scripts save a copy before each merge as config.yaml.bak-[TIMESTAMP]. Restore the latest backup and restart Frigate with docker restart frigate.

Cause

dxrtd, the DX-RT (DEEPX runtime) daemon, restarted under a running Frigate. The dxrt.service unit runs the daemon, so systemctl status dxrt.service shows when it restarted.

Fix

Run docker restart frigate.

Next steps

License and credits

This page uses Frigate NVR, Eclipse Mosquitto, MediaMTX, FFmpeg and paho-mqtt. Each is third-party software under its own license, so check it before you redistribute it. Loop only a test video you hold the rights to.