View your Anran Cameras&DVR in Homekit

In this guide, I will add 4 “Anran” camera’s to Homebridge/Homekit. The stream format from the cameras is not directly supported in Homekit so the incoming stream has to be converted into an mp4 stream. Homebridge will also automatically take still images to show in the Homekit dashboard so you can see the current state without starting the stream.

Requirements
  • A Raspberry Pi running
  • Docker Configured (Guide Here)
  • Homebridge configured (Guide Here)
  • Any type of ANRAN/ONVIF Camera or ONVIR Recorder

For this guide, I will be using the “NBD6808T” Recorder with 4 “Anran AR-AP2GA-WIFI” camera’s

The camera’s and recorder usually has streams available to the network. However, these streams are not in the correct format for Homekit so we need Homebridge to convert these streams to a compatible mp4 format.

prepare Homebridge

First, open up your Homebridge dashboard and click the plugin tab, then install the “homebridge-camera-ffmpeg v0.1.10” plugin using the searchbar

Then we need to add a few packages to our docker container, open the startup script and paste the following line on the bottom of the document

apk add --no-cache ffmpeg ffmpeg-libs

Then restart the docker container. When the container is restarted, check if ffmpeg libraries were installed by navigating to the terminal from that same menu and typing ffmpeg, The output should look something like this:

Adding camera feeds

You can add the stream from the recorder or the camera’s directly however I recommend using the recorder. This way there is minimal risk of failure in my opinion. First, you need to find the stream URL for your particular camera or recorder. This website has a huge list of camera/recorder models and the URL to access the stream for that device. The recorder I’m using is “ANRAN 8CH HD H.264 Recorder”. To add streams from this recorder in Homebridge, the following config is required (make sure to create anew “Cameras” array under the platform as shown below):

"platform": "Camera-ffmpeg",
"cameras": [
{
"name": "Garden",
"videoConfig": {
"source": "-re -i rtsp://192.168.1.220:554/user=admin&password=PASSWORD&channel=4&stream=0.sdp?real_stream--rtp-caching=100",
"stillImageSource": "-re -i rtsp://192.168.1.220:554/user=admin&password=PASSWORD&channel=4&stream=1.sdp?real_stream--rtp-caching=100",
"maxStreams": 2,
"maxWidth": 1280,
"maxHeight": 720,
"debug": true,
"maxFPS": 30
}
},

Info:

  • “name” – The name of the camera as it will show up in Homekit
  • “source” – The parameters for ffmpeg and the RTSP URL, this will differ per model
  • “stillImageSource” – The source for capturing still images, there was no built-in option so I will be using the stream URL to capture a single frame using ffmpg
  • “maxStreams” – Limit the maximum number of concurrent streams
  • “maxWidth” – Resolution width to stream to your device, lower = smoother
  • “maxHeight” – Resolution height to stream to your device, lower = smoother
  • “debug” – This will print more information in the log window, easier for debugging, can be disabled later
  • “maxFPS” – You can limit the FPS, this will lower bandwidth usage significantly
  • There are a few other options that can be set but these should be all to configure.

I found out that while the latest raspberry pi 3B+ has a fairly decent graphics chip built-in, when running Homebridge in docker this cannot be used to transcode the video from your camera’s which will result in slightly choppy images in Homekit but the thumbnails update as you would expect from a Homekit compatible camera

To add the camera’s to Homekit, tap the + on the top right and select “Don’t have a Code or Can’t Scan”. This will show a list of available devices to add to Homekit. If everything was set-up correctly, your camera’s should appear on this list. Simply tap them to add them to your dashboard, repeat this for each camera. You can check the logs on your Homebridge dashboard if something is not working correctly. It took me quite a while to get everything tweaked for optimal video but eventually, it’s all working now.

Leave a Reply

Leave a Reply

  Subscribe  
Notify of