Adding a video stream from an IP camera in Kodi TV using Surveillance Cameras add-on

Written by - 4 comments

Published on - Listed in Multimedia Kodi Surveillance


Kodi is not only a media library for movies and TV shows, it can also be used to use a video stream from a surveillance camera to show on screen.

Video stream from surveillance camera with ZoneMinder

In the past I've been using the ZoneMinder video add-on which connects to a ZoneMinder server. However there are a few problems with this setup:

  • Streaming the video source from ZoneMinder uses resources on the ZoneMinder server. Not only has ZoneMinder to do the processing (= cpu usage), it also uses a lot of bandwidth for the streaming.
  • In ZoneMinder you probably want to use a higher quality/resolution of the IP camera for a better recording. But for a live stream the quality doesn't have to be that high. Unless the same camera is defined several times with different qualities in ZoneMinder (which doesn't make sense), the high quality stream lands on the TV.
  • ZoneMinder acts like a (heavy) proxy between Kodi and IP camera, this is actually just wasted resources and adds lagging. After around 30 minutes of streaming a full hd (1080p) resolution from an IP camera through ZoneMinder to Kodi, the images lagged almost 30 seconds behind the reality.

Although ZoneMinder is the best open source tool for surveillance and ip camera recording, streaming its sources to yet another streaming application (such as Kodi) is definitely not its strength.

Installing Surveillance Cameras add-on

While looking for an alternative way to directly display the IP cameras video stream in Kodi without going through ZoneMinder, I found the Surveillance Cameras add-on, which is part of the official Kodi TV add-on repository (= no need to install an additional and unofficial repository).

The big advantage is it does what it says it does: It connects directly to a video stream of an IP camera, without having to go through yet another software or proxy.
The disadvantage: Only three cameras/streams can be configured and there is no multi-view (watch multiple streams at the same time) possible.

Nevertheless, I gave it a go.

In Kodi 18.x (Leia), the add-on can be installed by going to Add-ons -> Download -> Video add-ons and scroll down until Surveillance Cameras shows up. Or use the add-ons search, to find the add-on in the search results.

Kodi video add-on Surveillance Cameras

Once installed, the add-on needs to be configured.

Configuring the IP camera streams

In the add-on settings, the streams can be configured using the Configure button. 

Configure Kodi video add-on Surveillance Cameras

The stream configuration is very straight forward. 

In the number of cameras one can select the number of cameras (1-3) and then define the stream and location for each camera. The stream in this case is (usually) a rtsp address.

Configure Kodi video add-on Surveillance Cameras
Configure Kodi video add-on Surveillance Cameras

Depending on where and how Kodi runs, it may be easier to manually configure the add-ons settings.xml in a terminal. In my case Kodi runs on a LibreElec system to which I am able to connect with SSH.

The newly created config file for the Surveillance Cameras add-on can be found in  /storage/.kodi/userdata/addon_data/plugin.video.ipcams/:

LibreELEC:~ # cat /storage/.kodi/userdata/addon_data/plugin.video.ipcams/settings.xml
<settings>
    <setting id="cam1" value="rtsp" />
    <setting id="cam2" value="" />
    <setting id="cam3" value="" />
    <setting id="loc1" value="" />
    <setting id="loc2" value="" />
    <setting id="loc3" value="" />
    <setting id="numcams" value="1" />
</settings>

Here the previous (incomplete) setting for the rtsp path is showing up. This config file can now manually be configured. Here I added two cameras (increased the numcams setting to 2) and defined their streams:

LibreELEC:~ # cat /storage/.kodi/userdata/addon_data/plugin.video.ipcams/settings.xml
<settings>
    <setting id="cam1" value="rtsp://user:password@IP.address.camera.one:554/cam/realmonitor?channel=1&subtype=1" />
    <setting id="cam2" value="rtsp://user:password@IP.address.camera.two:554/cam/realmonitor?channel=1&subtype=1" />
    <setting id="cam3" value="" />
    <setting id="loc1" value="Door" />
    <setting id="loc2" value="Garage" />
    <setting id="loc3" value="" />
    <setting id="numcams" value="2" />
</settings>

Note: If a camera requires authentication before the stream is shown, the credentials can be be added in the following style: rtsp://user:password@ip.address.of.camera:554/path/to/video/stream

When launching the add-on again in Kodi, both cameras should now show up with their relevant description (Location):

Kodi video add-on Surveillance Cameras two streams

And finally how the camera stream looks like on screen:

Use lower quality sub stream

To benefit from a very quick image update and real-time streaming, one should use a lower quality sub-stream of the IP camera. Newer IP cameras often have the possibility to define multiple streams. A primary stream for high quality images (for example for recording or image zooming) and a secondary (or even more) streams with a lower resolution. Forcibly a lower resolution results in less bandwidth and the chances of image delay decreases.

Depending on the camera vendor and model, the paths to the primary and sub streams vary a lot. As my setup runs with IP cameras from Dahua, the stream addresses is the same for all models (IPC-HFW4300S, IPC-HFW1320S, IPC-HFW1420S and IPC-HDBW1320E):

Primary stream: rtsp://user:password@ip.address.of.camera:554/cam/realmonitor?channel=1&subtype=0
Sub (secondary) stream: rtsp://user:password@ip.address.of.camera:554/cam/realmonitor?channel=1&subtype=1

Note the subtype value.

For other cameras the ZoneMinder Wiki is highly recommended. It has a very nice overview of the different video stream addresses for all kinds of camera models.


Add a comment

Show form to leave a comment

Comments (newest first)

ck from Switzerland wrote on Sep 26th, 2021:

Hi dvtc, it is more a question of what model your IP camera is. If it has a RTSP stream, you can access the stream via Kodi.


dvtc from wrote on Sep 24th, 2021:

I have an ip camera that access is via the YCC365 Plus cloud app. Do you have any idea how to access through Lobreelec/Kodi?
Thanks!


Claudio Kuenzler from Switzerland wrote on Apr 29th, 2021:

sunba, I used "vim" directly in the Kodi server. If you dont feel at ease on the command line, you can enable the Samba Service in Kodi and then access the XML in a File Explorer (Network Share) and edit it there.


sunba from wrote on Apr 29th, 2021:

How did you "manually configure" that xml file?


RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Icingaweb   Icingaweb2   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder   


Update cookies preferences