Back in spring 2020 I started messing about with PoE, RTSP-capable cameras. I set up a livestream scheduled to push a feed up to YouTube using an old MacBook Pro, OBS and an Automator script. At first it was just a single camera. A simple wide shot of the north garden was streamed for a few hours each day.
Then in March 2022, I added a USB camera connected to the laptop and pointed it at a window-mounted hummingbird feeder. I liked the addition so much I added an Amcrest UltraHD 5MP–another PoE camera–for which I ran a cable, mounted on a metal trail cam stake and pointed at the birdbath closest to my office.
I was pretty happy with that setup, although the MacBook Air occasionally suffered random issues which caused streaming failures, particularly falling off the network or wanting to authenticate to iCloud, but at that point it was a ten-year-old machine. It was during this time I started having the audio analyzed via BirdWeather.com.
For those not into birds or birding, Birdweather was at the time a rather simple site that took the audio feeds from several different types of sources and ran them through the Cornell Lab of Ornithology Birdnet “stuff” to analyze the song data and identify what species were heard. (I said it was simple back then; more about that later.) They could analyze a variety of options, audio from a YouTube stream being one of them (which is how I learned we occasionally are host to Great Blue Herons and Killdeers).
Then the original PoE camera, a Ubiquiti UniFi Protect G3 PRO Camera, died. It was on the expensive side and the optics were great, but it was not super-robust and died after two years. Even though it was mounted under the eaves, it succumbed to moisture issues, but Agent Smith did have fun dissecting the corpse.
I figured I would just replace it with another Amcrest like the one pointed at the birdbath. It was only after the second camera arrived and I started mucking about with it that I realized the camera has no microphone. I belatedly checked the specs to discover that, while there is an audio option in the settings, that option does nothing. A bit of online shopping and I picked up the 5MP’s big sister: the 4K 8MP. It went up where the Ubiquiti had been and I put in a larger PoE switch so I could make use of that spare 5MP. I put it on another trailcam stake and pointed it at the far birdbath.
Things were ok for a long while and though I still had connectivity issues with the old laptop handling the stream, most of the time things worked. Then this past fall, I got a new desktop machine to replace my 5-year-old iMac. The new machine would have no problem running the stream, so I could retire the now 12-year-old laptop. There was just one problem: my previous hackinator-style-scripts that handled starting and stopping the stream didn’t work on the new machine. This meant that I had to manually start or stop the stream, and there was no archival option available for a stream that went longer than YouTube’s 12 hour limit, since streams only under 12 hours can be viewed after they have ended.
Since OBS doesn’t actually have a proper scheduling option, I started looking at other ways to solve my problems. After testing a bunch of options like Wirecast, Ecamm Live and others, I found that there are really no other options for my particular streaming needs. Most are geared towards people streaming themselves at their computer (think gamers or craft videos or webinars), and even if they have a scheduling option, most don’t support using RTSP streams. So after a week or so of scrounging about it was back to trying to make OBS work.
During my research, I did find a handy feature of which I wasn’t aware–a snazzy plugin for OBS that allows you create “scenes” and switch between them, aptly named Advanced Scene Switcher. Thanks to some handy macros, I was soon up and running a revamped stream that happily cycled between all the cameras at regular intervals. I still hadn’t solved the automated stop/start quandary, but it was a start.
As the stream was running, and not starting/stopping on a schedule to mitigate the 12-hour limit issue, I had plenty of other projects to keep me busy, so I let things lie for a while. Over a few months I’d poke at the problem every so often. First I tried creating an Automator app, which failed. Then I tried to create another Automator app, and that too failed. Then I tried a package off GitHub that extended some of the command-line options within OBS. That proved almost to be the trick. A simple shell script to kill off OBS with a short pause and then a call to reopen the app worked, but because I stream to YouTube, there was the matter of extra things that have to be clicked and sadly, there’s no easy way to create a reliable script for that sort of thing. Then I had an idea–why not investigate other streaming site options? And then, I hit upon Restream. Not only would Restream allow me to get around all the extra clicky-bits necessary to start streaming to YouTube, but I could resurrect my very, very old and incredibly dust-covered Twitch channel.
Crafting a script to start up OBS and have it start streaming to Restream.io turned out to be a much simpler task, but then I hit one last snag–getting my computer to run the script at set times. Sadly I couldn’t get launchd and my crontab to play nicely, but years ago I had used an app called Lingon to handle scheduling stuff, as sometimes the crontab under MacOS is, well, a bit wonky. So I re-downloaded Lingon and started messing about. Still no happiness.
Then I discovered the magic one-two combination. Make the shell script live within an Automator app first, then have Lingon use the “open” command before the full path to the wee app. All of sudden things just worked. It was magical.
Now twice a day I see this in my Inbox:
There you have it. The long, arduous road to making a livestream of the north gardens work how I wanted it to to work. There was a bit of wonkiness with the Amcrest 5MP cameras not sending reliable data to OBS; I tried replacing the PoE cables and adjusting all the settings. I even contacted Amcrest support and completely stumped them. In the end I replaced those cameras with an Annie C800 4K and a Reolink CX410, and the problems magically vanished. I may investigate camera options to replace the remaining Amcrest unit eventually if mucking with its settings doesn’t help sharpen up the video quality, but usually everything is working as intended.
The gardener’s nicking the ethernet cables with their equipment means that one of the cameras is dead as of this posting, but we have plans to use some spare fence material to run the ethernet cables to and through to keep them off the ground–more on that soon probably.
If want to check out the comings and goings of the birds, the stream is linked in the top menu.