iSpy Agent DVR in Docker

Agent DVR - Agent DVR is a standalone replacement for iSpy that runs as a service, uses less CPU and features a web user interface that is accessible from anywhere with no port forwarding required!

Agent runs it's own webserver. By default this is running at http://localhost:8090 on the PC running Agent (although it may be using a different port if that wasn't available or was changed when it was installed). Agent will also work over your local network - you can use private IP addresses or computer names to access Agent locally (examples: http://192.168.1.10:8090 or http://nvr:8090). You may need to open your firewall to Agent for your local network.

Setup

You need to have Docker installed before continue with this guide.

You can build the image by cloning the repository and running the following command from inside the directory:

git clone https://github.com/mpolinowski/agent-dvr-docker.git && cd agent-dvr-docker
docker build -t agent-dvr .

To persist data generated inside the running container later we have to create 3 directories on the host system (you can choose the location at will - but you will need to adjust the RUN command below accordingly):

sudo mkdir -p /opt/dvr-agent/{config,media,commands}
sudo chown -R myuser /opt/dvr-agent/*

You need to expose the port 8090 for the web user interface. The ports 3478 (STUN) and 50000 - 50010 (TURN) are needed for the webRTC video connection:

docker run -it -p 8090:8090 -p 3478:3478/udp -p 50000-50010:50000-50010/udp \
-v /opt/dvr-agent/config/:/agent/Media/XML/ \
-v /opt/dvr-agent/media/:/agent/Media/WebServerRoot/Media/ \
-v /opt/dvr-agent/commands:/agent/Commands/ \
-e TZ=Europe/Berlin \
--name agent-dvr agent-dvr:latest

This command runs the container process attached to your terminal and allows you to spot eventual error messages. To run the container in the background and make sure that it is restarted automatically if needed use the following command:

docker run --restart=unless-stopped -d -p 8090:8090 -p 3478:3478/udp -p 50000-50010:50000-50010/udp \
-v /opt/dvr-agent/config/:/agent/Media/XML/ \
-v /opt/dvr-agent/media/:/agent/Media/WebServerRoot/Media/ \
-v /opt/dvr-agent/commands:/agent/Commands/ \
-e TZ=Europe/Berlin \
--name agent-dvr agent-dvr:latest

You can kill the container with the following command:

docker rm -f agent-dvr

You can visit the webUI in your browser on http://localhost:8090 and allow Agent to access your media devices:

iSpy Agent DVR in Docker

Adding your INSTAR 2k+ WQHD Camera

Open the Server Menu and click to add a new device:

iSpy Agent DVR in Docker

Select a display slot:

iSpy Agent DVR in Docker

Here you can add a new device - choose to add a new Video Source:

iSpy Agent DVR in Docker

Configure the video source according to your needs:

iSpy Agent DVR in Docker

Give your video source a name and assign it to a Location and Group. As Source Type select an IP Camera and click the three dots to configure it:

iSpy Agent DVR in Docker

The DVR Agents needs your camera login as well as the RTSP URL of your camera:

iSpy Agent DVR in Docker

Configure the video source according to your needs:

iSpy Agent DVR in Docker

Close the configuration menu and check if the video stream was added:

iSpy Agent DVR in Docker

Adding MQTT Events

The DVR Agent can be connected to an MQTT Broker in your network to update MQTT topics in case of a variety of events. One example is sending an alarm notification when motion was detected in your camera's live stream. You can activate this option in your camera configuration:

iSpy Agent DVR in Docker

But to be able to send updates we first have to connect the Agent to our MQTT Broker - for example the INSTAR MQTT Broker on your camera. To do this first switch to the Actions configuration tab (see image above) and add an MQTT Action for your camera:

iSpy Agent DVR in Docker

In the following example we tell the Agent to update an MQTT Topic in case of an alert. And to use a base64 encoded snapshot of your camera as payload - this image can be embedded in web interfaces (e.g. the dashboard from your smarthome) so every time an alert is triggered a fresh snapshot from your camera is displayed:

iSpy Agent DVR in Docker

Now to adding your MQTT Broker - open the Software Settings:

iSpy Agent DVR in Docker

Switch to the MQTT Tab:

iSpy Agent DVR in Docker

And add the address and login from your camera's MQTT Broker:

iSpy Agent DVR in Docker

Now every time an alert is triggered you additionally receive an MQTT update on the configured topic and the base64 encoded snapshot of the potential intruder:

iSpy Agent DVR in Docker