After Izon announced that they were closing down their services (leaving the cameras I already owned useless), I decided to turn them into something useful using Azure. First let me list some resources:
- RSA Security Research – by Mark Stanislav
- Will it hack
- Azure IoT Edge product page
- VLC download page
Use the Will it hack link to get access to the mobileye website and verify that the Izon device is still streaming and still working. If it is working, you are already done with edits to the device unless you would like to change the passwords (which you should).
Our goals are as follows:
- Process the video feed from the Izon camera (we will cheat this early on and only use the image feed)
- Check for motion
- Check for faces
- Check if faces are white listed
- Check for my dog
- Process the audio feed
- Check for any noise
- Check for non human noises
- Check for dog barks
- Check for my and my wife’s voice
These are all stretch goals that will be referred back to as the project moves forward.
Create the Azure IoT Edge module
For the first module, we will use the C Module base image. We are looking for two things from this module:
- Download the picture feed and pass it to the Edge Hub
- Download the audio feed and pass it to the Edge Hub
If you don’t know where to get started with the C module of the Azure IoT Edge platform, there is helpful information on the Azure Documentation page. Once the C module is created and ready for editing, we are going to connect to the image feed from the devices. To make this simple, both feeds will be retrieved using HTTP. For the video feed, its simple enough to grab images from the Izon camera existing camera feed.
Now one thing we need, is to be able to connect to each camera within the local network shared with the Edge. Since we would like to be able to add and remove cameras, we will use the device twin to update and manage the list of IP address. The code for updating the list is as follows:
With that code in place, the list of IP addresses can be updated from the Azure UI and the Azure Service SDKs.
Downloading from the Image feed
The Izon cameras make downloading the image feed trivial. There is an existing endpoint where you can grab the latest image directly from the camera’s web server. The latest image is always at /cgi-bin/img-d1.cgi. (NOTE: if you are checking this image from a browser, be sure to have some cache busting!). To download this image into our module, we will use the Curl library for it’s easy HTTP implementation. To add Curl to our Edge module, we will add the following lines to the Dockerfile.amd64.debug:
With curl now added to the image, it can be utilized in code by adding it to the method invoked in our main loop. The code will download the file for each entry in the IP address list. Once the image is downloaded, it will send it as a message to the Edge Hub and add the IP address of the camera to the message header. Here is that code:
Downloading from the Audio feed
Now that the image feed is being published to the Edge Hub, its time to connect the audio feed. The audio feed is trickier since the Izon camera doesn’t have an easy to use endpoint (that I know of) for downloading the audio samples like we can with the image feed. In the next entry in this series, an Audio feed will be derived from an RSTP stream.