I’ve recently become a Ubiquiti UniFi disciple, including replacing our builder-basicdoorbell from 1998 with Ubituiti G4 Doorbell Pro. This has brought me into theUniFi Protect ecosystem.
Protect is absolutely designed to work with UniFi cameras — as one wouldexpect — but they do have some basic support for third-partycameras that support ONVIF.
It occurred to me that I have a small collection of minicomputers in the housethat 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-partycamera in Protect?
My first step was to see if I could find an app on the App Store that nativelysupports streaming via ONVIF. If one exists, I couldn’t find it.
However, while researching how to handle this, it became apparent that, tomy limited understanding, ONVIF is more of a handshaking protocol. When itcomes to video streaming, the assumption is that RTSP will handlethe actual streaming.
Which got me wondering if I could do some combination of
RTSP app → some sort of ONVIF wrapper/proxy → ProtectIn principle, that should work.
I started by casting about to find an app that would stream RTSP from thephone. I found a couple, but the one that seemed to work best for me isIP Camera Lite. It’s not intuitive, but it has a free tier for meto test with, and once I got my head around how the app works, it wasreasonably simple.
However, I needed to prove to myself that it was working. So, I turnedto my dear old friend , ffmpegffplay. Once I hadthe 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 aperson going down a vaguely similar path. They made mention of tryingto 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’vebeen using Docker for a few years now.
At first, I was running things attached/live in the console, to seelogs and error messages as they came in. After beating my head againstthe wall for a while, I got the container to the point that it wasn’terroring 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 thatI installed in my Synology. You can determine this using ifconfig.I set the correct IP address and path for the iPhone’s streamI absolutely had to set the correct width/height, otherwise it wouldn’twork. To do so, I just took a look at the ffplay console output fromearlier and cribbed the values from there.After getting things to the point that they seemed okay, I loaded UniFi Protecton my computer, and navigated to Settings → System → Advanced, where Ihad to tick on Discover 3rd-Party Cameras.
Then, in the UniFi Devices section (found in the left sidebar), I would seethe new device. I clicked on Click to Adopt, and was challenged for ausername and password. I used admin for both, which appears to be the defaultfor the IP Camera app.
At first, I was presented with an endless spinner, as I hadn’t configured thingsproperly. The documentation on Github is enough, but frustratingly, the failuremode I ran into was the video just… not loading. However, I eventually gotit 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.
