I’ve recently become a Ubiquiti UniFi disciple, including replacing our builder-basic doorbell from 1998 with Ubituiti G4 Doorbell Pro. This has brought me into the UniFi Protect ecosystem.
Protect is absolutely designed to work with UniFi cameras — as one would expect — but they do have some basic support for third-party cameras that support ONVIF.
It occurred to me that I have a small collection of minicomputers in the house that I’m not using anymore. Further, those minicomputers all have cameras built-in. So that got me thinking, can I use one of these old iPhones as a third-party camera in Protect?
My first step was to see if I could find an app on the App Store that natively supports streaming via ONVIF. If one exists, I couldn’t find it.
However, while researching how to handle this, it became apparent that, to my limited understanding, ONVIF is more of a handshaking protocol. When it comes to video streaming, the assumption is that RTSP will handle the actual streaming.
Which got me wondering if I could do some combination of
RTSP app → some sort of ONVIF wrapper/proxy → Protect
In principle, that should work.
I started by casting about to find an app that would stream RTSP from the phone. I found a couple, but the one that seemed to work best for me is IP Camera Lite. It’s not intuitive, but it has a free tier for me to test with, and once I got my head around how the app works, it was reasonably simple.
However, I needed to prove to myself that it was working. So, I turned
to my dear old friend , ffmpeg
ffplay
. Once I had
the app running and configured, I tried to play the stream:
ffplay rtsp://admin:admin@192.168.17.189:8554/live
Sure enough, I had a stream of the phone’s camera (and microphone).
Sometime recently I had stumbled upon a Reddit post that explored a person going down a vaguely similar path. They made mention of trying to get a Docker container working to do the ONVIF side of things, but couldn’t make heads nor tails of it.
I figured it couldn’t hurt to see if I could get it to work, as I’ve been using Docker for a few years now.
At first, I was running things attached/live in the console, to see logs and error messages as they came in. After beating my head against the wall for a while, I got the container to the point that it wasn’t erroring on startup.
I had to make a few changes to the config.yaml
:
- I switched to
eth4
, which happens to be the 10GbE daughter card that I installed in my Synology. You can determine this usingifconfig
. - I set the correct IP address and path for the iPhone’s stream
- I absolutely had to set the correct width/height, otherwise it wouldn’t
work. To do so, I just took a look at the
ffplay
console output from earlier and cribbed the values from there.
After getting things to the point that they seemed okay, I loaded UniFi Protect
on my computer, and navigated to Settings
→ System
→ Advanced
, where I
had to tick on Discover 3rd-Party Cameras
.
Then, in the UniFi Devices
section (found in the left sidebar), I would see
the new device. I clicked on Click to Adopt
, and was challenged for a
username and password. I used admin
for both, which appears to be the default
for the IP Camera app.
At first, I was presented with an endless spinner, as I hadn’t configured things properly. The documentation on Github is enough, but frustratingly, the failure mode I ran into was the video just… not loading. However, I eventually got it nailed down, and now I have a new camera in Protect.
Thanks to this, I can now retire both Surveillance Station and Scrypted, which I was using previously before I moved to Protect.