BUT I wanted to do more with the video without having to rely on an internet connection via the web site or smartphone app... so I needed access to the local video stream. I came across a great application called 'Restreamer', which converts the rtsp stream that the camera produces into an internet browser-friendly video stream. Restreamer is available in a simple to setup Docker image for the Raspberry Pi (or on Windows/Mac etc). I recently wrote a how-to for Docker setup on the Raspberry Pi here. In this case I would recommend using a version of the Pi with more oomph, eg the v3 or v4.
Restreamer user interface |
Using Restreamer with the IP camera rtsp stream, I have been able to easily...
(1) Incorporate a website-friendly camera feed into my birdbox camera/weather 'dashboard'
[ *Hint* - it's the top left camera feed ]...
My 'Wildlife dashboard' incorporates Birdsy video stream via Restreamer, not the rtsp stream sent to the Birdsy servers and pulled back again via the Birdsy website (i'm not sure that's even possible) .
See this post that describes by Grafana wildlife dashboards in more detail. By including the live, local camera video feed , I'm not reliant on pulling a live feed back off their website. This does not interfere with normal operation of the Birdsy camera (or any other IP camera at that). All the bird species AI goodness that Birdsy offers still requires the website login/app. My dashboard is only available on my local network.
How does this work?... Restreamer converts the local rtsp video stream into a format that the Grafana dashboard can present in an html 'i-frame'. The output from Restreamer is for this Grafana panel is:
<iframe src="http://XXX.XXX.X.XX:9090/player.html" name="restreamer-player" width="704" height="500" scrolling="no" frameborder="0" webkitallowfullscreen="true" mozallowfullscreen="true" allowfullscreen="true"></iframe>
'http://XXX.XXX.X.XX' represents the IP address of the Raspberry pi running Restreamer. Port 9090 is configured in the docker Restreamer container used to make the birdsy IP camera feed available. You can spin up as many Restreamer Docker containers as you want, just assign a different port for each camera - instructions on the Restreamer website.
(2) Push the livestream elsewhere... e.g. Stream live to YouTube
A few years ago I live streamed a Robin nest to YouTube using using a program called ffmpeg. It was a fiddle to setup and involved a long and convoluted command line to run it. If you want to watch four hours of robin chicks check out this archived link: https://youtu.be/lMOGX1dMaO8
Anyway Restreamer makes to really simple to push the local rtsp stream direct to YouTube, Twitch, Facebook, Vimeo etc (I know what at least two of these are....). The screenshot below is my Birdsy Camera feed pushed direct to YouTube, however any rtsp camera where you can access the local feed should work equally well.
(3) Push the camera feed into alternative, locally run motion capture software
[ Video clip motion-captured locally using free CCTV application 'Zoneminder' . Technically this used the rtsp feed direct from the camera, and not via Restreamer]
This gif was generated from a Zoneminder-motion captured clip. I don't recommend Zoneminder as it's user interface is clunky and I found retrieving captured video to be non-intuitive and fiddly. I only used it as there is a Docker container available for the raspberry pi. Other motion capture software is available, i will do a future post on economical local motion capture options (i.e. not reliant on the cloud and an 'always on' internet connection).
Look a chap in the eye... |
Restreamer brief overview
See https://datarhei.github.io/restreamer/
Restreamer takes a variety of video stream sources and converts it into a web browser-friendly format. For my IP camera it was as simple as entering the IP camera's rtsp stream and pressing Start.
Stream locally and also to external services (Youtube etc) |
For an IP camera, the format is: rtsp://username:password@Camera'sIPaddress:port/streamLocation
The username and password can be found in your camera's literature (be sure to change it...)
I located the IP address and rtsp stream location of my Networked IP camera using a windows program called IPCManager, this gives access to loads of behind the scenes camera configuration options.
The instructions for adding a Restreamer container to Docker can be found here:
https://datarhei.github.io/restreamer/docs/installation-linux-arm.html
I'm running it on the fastest Raspberry Pi currently available (Pi 4) with 4Gb ram - as I dont want this to be a bottleneck. There are Docker images available to run in Windows or Linux Docker installations too.
Next job is to look at options for local motion capture, probably starting with Docker applications on my trusty Raspberry Pi
This has been super useful! I'm struggling to find the (default?) credentials Birdsy uses on the camera. Where did you find yours?
ReplyDeleteIt depends which camera verision you have. If it’s the green one, then you’re out of luck as they haven’t released the rtsp access details. I have a pre-release one (white), which has the username and password on the box. The rtsp address is shown on a screenshot above. The same user and login does not work on the green one which is their v1 commercial release. I suspect it’s because it’ll also get you access to the on-chip ML model that is used to do one initial ‘its a bird’ classification, plus if you’re forced to watch the livestream via their website then they’ve got the option to use monetise via adverts if they want to (they don’t at the moment) if I’m honest it’s my main dislike about the commercial system since it’s totally locked down and a live view presumably relies on you having an active internet connection and all that goes with that when you’re kids are streaming Netflix etc…
ReplyDeleteUgh, that is really annoying. I backed them for two green cams and to be honest it hasn't been worth it. A decent IP cam would deliver better video quality and the AI is... questionable at best when it comes to bird detection and id.
DeleteMy next step will be to sniff the traffic while setting up a camera from new – hopefully I can pick up credentials in cleartext from that.
But interesting to know there's on-device ML involved – my assumption was everything was happening in their private cloud.
My understanding is that the on-camera AI identifies bird/animal, then sends the clip to the cloud where the species AI happens. That way is better as it does not rely on 24/7 streaming as a business model which I’ve assumed would limit the number of cameras per household. Feel free to follow/DM on the Twitter or via email link for other options :]
DeleteMy understanding is that the on-camera AI identifies bird/animal, then sends the clip to the cloud where the species AI happens. That way is better as it does not rely on 24/7 streaming as a business model which I’ve assumed would limit the number of cameras per household. Feel free to follow/DM on the Twitter or via email link for other options :]
DeleteThat seems to be the case indeed! Your twitter doesn't allow DMs but happy to share the progress I've made so far...
Delete