Raspberry Pi as NVR with Shinobi

Last Updated on 4 January 2021 by Suffocation

Mein Aktuelle NVR (Network Video Recorder) hat so seine Tücken und ich suche nach einer Alternativen. Das alte Modell von Corseer, war zwar das für mich am besten funktionierende unter allen 6 Modellen, welche ich getestet hatte aber es gibt keine Updates mehr, 2 von 4 Kameras funktionieren nicht und Corseer erlaubt, wie andere Herstelle auch, nur eigene Kameras.

Da dachte ich mir hier gibts doch sicherlich auch was für den Raspberry Pi. Nach kurzen googeln fand ich die Software vom Shinobi which had already been tested on the Raspberry. I will briefly outline the installation on an existing Raspberry and its configuration in this report. Since I have, from time to time, over the past few months ESP Cams gespielt habe, wäre zudem nett solch eine Kamera einzubinden.

If the Raspberry still needs to be installed, then here A brief guide.

Facts

Shinobi selbst wird über ein Webinterface verwaltet und gesteuert, was den Einsatz im eigenen Netzwerk erleichtert. Die Software soll auf einem Raspberry PI ab Version 3B laufen.

Areas of application

  • Video Recorder für IP Kameras
  • Number plate recognition
  • Motion detection
  • Camera control
  • Fernsteuerung über Webinterface

Cameras

Voraussetzungen für die Kameras gibt es nicht viele:

  • It must be an IP camera
  • Das Übertragungsprotokoll sollte von Shinobi unterstützt werden.
  • Onvif Unterstützung kann nicht schaden.
  • Sie muss durch den PI übers Netz erreichbar sein

Versions used by me

  • MariaDB 10.1.45-MariaDB-0+deb9u1
  • Raspbian 9.11
  • Ninja

Hardware used

  • Raspberry Pi 3b + Pi 4 with 4 MB
  • ESP32 Cam

Licence

Der Sourcecode ist frei. Für die Nutzung gibts es ein einfaches Lizenzmodell. Für nicht kommerzielle Zwecke gibts eine Freie (CE) Version und für den kommerziellen Gebrauch eine Pro Variante mit Subkription.

The free version, also called the community version, is only updated for major releases or when bug fixes are introduced. The commercial version is more agile in this regard.

More details, please. Manufacturer's page extract.

Views

An dieser Stelle ein paar Eindrücke der Oberfläche, mehr dazu später.

Installation

Shinobi bietet ein Installation Skript. Zur interaktiven Installation die folgende Zeilen über SSH oder Console eingeben:

sudo su

bash <(curl -s https://gitlab.com/Shinobi-Systems/Shinobi-Installer/raw/master/shinobi-install.sh)

Dann durch Konsolenmenü navigieren. Ich habe die Installation mal im Standardverzeichnis gestartet anderer werden hier lieber srv o.ä. wählen wollen.

Console Starten der Installation
Start installation from console

Als Konfiguration wähle ich Ubuntu, diese scheint laut Web gut auf dem PI zu funktionieren.

Console Ubuntu Auswahl
Ubuntu Console Selection

IPv6 ist mir nicht wichtig da ich noch hauptsächlich IPv4 verwende.

Console Ausschalten IPv6
Turn off console IPv6

Zum Abschluss werden die Login Daten für den Browser noch angezeigt.

Console Abschluss Installation mit Logindaten
Console installation completion with login details

Port ändern

I already have a Tomcat installed, so I can't use port 8080. Therefore, I have changed the port to 8081. This is done in conf.json in the Shinobi installation directory (in my case /home/Shinobi).

root@pi1:/home/Shinobi# vi conf.json
vi Port ändern
vi Port ändern

Den Port von 8080 auf 8081 ändern und speichern.

Shinobi Restart

root@pi1:/home/Shinobi# shinobi restart
Console Shinobi neu starten
Restart Console Shinobi

Initial configuration

First login

The link now looks like this for me:

http://192.168.1.10:8081/super

Diesen in einem Browser öffnen und mit den Logindaten aus der Console befüllen.

Default Superuser: admin@shinobi.video
Default Password: admin

Browser, Login Seite für Shinobi
Browser, Login Seite für Shinobi

Sollte nicht das folgende Bild, kommen Schaut mal im Kapitel Probleme nach evtl. gibts dort eine Lösung.

Shinobi im Browser nach erfolgreichen Superuser Login
Shinobi in the browser after successful Superuser login

Superuser Passwort ändern

Aus Sicherheitsgründen sollte als erstes das Superuser Passwort geändert werden, damit kein Anderer auf den NVR administrativ zugreifen kann.

Im Menü den Eintrag „Preferences“ wählen, zweimal das neue (sichere) Passwort eingeben und mit dem Knopf „Save“ bestätigen. (Den Knopf, auch wenn er sehr groß ist, habe ich erst auf den zweiten Blicke gefunden. Würde ihn eher am Ende der Seite erwarten.)

Shinobi Browser - Superuser Passwort ändern
Shinobi Browser – Superuser Passwort ändern

Create user account

Start account creation

Shinobi - Neuer Benutzer, Erstellung starten
Shinobi – New User, Start Creation

Email Adresse eintragen und Passwort wählen.

Shinobi - Neuer Benutzer, Email und Passwort wählen
Shinobi – Neuer Benutzer, Email und Passwort wählen

Erstmal alle Previlegien, später können wir das noch einschränken. Mit Save (oh der Button ist ja unten 😉 ) bestätigen.

Shinobi - Neuer Benutzer, Previlegien wählen und speichern
Shinobi – Neuer Benutzer, Previlegien wählen und speichern

A new user has been created.

Shinobi - Neuer Benutzer, wurde erfolgreich erstellt
Shinobi – New user, successfully created

Basic settings

Die Einstellungen können erst einmal so bleiben wie sie sind.

Shinobi - Einstellungen
Shinobi – Settings

Beim Durchstöbern ist mir noch augefallen, dass das DB Passwort fehlt. D.h. es gibt einen Benutzer ohne Passwort in der Datenbank.

Shinobi - Einstellungen: Fehlendes DB Passwort
Shinobi – Settings: Missing DB Password

Ich habe erst das Passwort in den Einstellungen geändert und gespeichert:

Shinobi - Einstellungen: Passwort für DB setzen
Shinobi – Einstellungen: Passwort für DB setzen

After that, set the password in the database:

Mysql Client öffnen

mysql -u root -h localhost -p.

The following script to be lodged

SET PASSWORD FOR majesticflame@127.0.0.1 = PASSWORD('Das_Neue_Passwort');
EXIT;

Restart Shinobi

root@pi1:/home/Shinobi# shinobi restart

Camera Configuration

Die Einstellungen die Shinobi bietet, sind wirklich erstaunlich. Wenn man neu in die Materie einsteigt, weiss man nicht wo man anfangen soll ;). Hier mein Weg mit der ESP32 Cam. Ich habe zwei Konfigurationen erstellt. Eine für mit MPEG Stream und eine mit Jpeg Schnappschüssen. Aber zuerstmal in die das Dashboard einloggen.

Log in

URL is

http://<IP>:<port> 

In my case, it is:

http://192.168.1.66:81

Afterwards, log in with the newly created user.

Shinobi Login Dashboard
Shinobi Login Dashboard

Ein erster Blick auf die strukturiert Oberfläche.

Shinobi Dashboard Oberfläche
Shinobi Dashboard Oberfläche
  1. Function selection – here you'll find all operating modes, including things like an Onvif Detector
  2. Monitor list, each monitor roughly corresponds to a configured camera
  3. Ein paar Informationen über CPU Auslastung, Arbeitsspeicher und Festplattenplatz.
  4. Offene Monitore, hier können die Kamera Streams betrachtet werden
  5. Neben anderen Knöpfen ist hier der + Knopf zum hinzufügen einer Kamera.

Um einen Monitor (Kamerakonfiguration) zu erstellen wird der + Knopf betätigt. Dies habe ich im Folgenden zweimal getan. Einmal für die MJPeg Konfiguration und nochmal für die JPeg Einzelbilder.

MJPeg Configuration

Namen eingeben, dieser wird dann in der Übersichsanzeige links mit angezeigt. Der Rest in diesem Abschnitt bleibt unberührt.

Shinobi ESP32Cam MJPEG Neuer Monitor
Shinobi ESP32Cam MJPEG New Monitor

Für die Verbindung die Art MJPEG und die URL eintragen.

Shinobi ESP32Cam MJPEG Verbindung einstellen
Setting up a Shinobi ESP32Cam MJPEG connection

The input still needs to be configured. These values can still be adjusted for optimisation. I've set the framerate to 3, which is roughly the average of ESP32-CAM mit einer Auflösung von 800×600 bei mir ist. Die Hardware Beschleunigung lasse ich ersteinmal aus, um Fehlerquellen zu reduzieren.

Shinobi ESP32Cam MJPEG Eingang einstellen
Configure Shinobi ESP32Cam MJPEG input

Die Stream Einstellungen sind sehr konservativ gewählt.

Shinobi ESP32Cam MJPEG Strean einstellen
Configure Shinobi ESP32Cam MJPEG Stream

With these settings, I was able to display the first images. It takes a while for the first image to appear, so have some patience. The settings can certainly be optimised.

Shinobi ESP32Cam MJPEG Erster Blick durch die Kamera
Shinobi ESP32Cam MJPEG First Look Through the Camera

Bei mir kommt eine langsame Diashow an. Auch diverse Anpassungen der Einstellungen führten bei mir auf dem RPI3 nicht zu einer Verbesserung. Im ISpy geteste, läuft es flüssiger.

JPEG Configuration

Here is the single image configuration. Give it a descriptive name.

Shinobi ESP32Cam JPEG Einstellungen Monitor
Shinobi ESP32Cam JPEG Settings Monitor

Set JPEG.

Shinobi ESP32Cam JPEG Einstellungen Verbindung
Shinobi ESP32Cam JPEG Settings Connection

Configure the input. (Hardware acceleration disabled for now to avoid errors)

Shinobi ESP32Cam JPEG Einstellungen Eingang
Shinobi ESP32Cam JPEG Settings Input

Finally, set up the stream.

Shinobi ESP32Cam JPEG Einstellungen Stream
Shinobi ESP32Cam JPEG stream settings

So sieht es bei mir aus. Die Bilder kommen bei mir flüssiger und klarer als beim MJPEG Stream.

Shinobi ESP32Cam JPEG Ein erstes Bild
Shinobi ESP32Cam JPEG A first image

Problems

Website not found

Bei mir ist bereits ein Tomcat installiert. Dieser hat natürlich nicht die Shinobi Applikation verfügbar was das Bild unten erklärt. Ich habe den Port des Shinobi Servers geändert, siehe hierzu auch the relevant section in the Installation chapter.

Browser Shibnobi Website /super konnte nicht gefunden werden
Browser Shibnobi Website /super could not be found

Database not accessible

The database was not installed with it for me. This is what it looks like after the superuser login:

Browser Nach Login, Datenbank läuft nicht.
Browser Nach Login, Datenbank läuft nicht.

Manually install the database. I'll just give a brief outline here, as the process is well described at the following link: https://staticfloat.de/mariadb-10-auf-raspberry-pi-installieren

Install DB Server and Client

sudo apt-get install mariadb-client mariadb-server

Server einrichten

Create root and define password.

sudo mysql -u root -p

In der Sql Console Previlegien bestätigen und die Console schliessen

flush privileges;
exit;

Configure my.conf

sudo nano /etc/mysql/my.conf

folgende Zeilen einfügen:

port = 3306
bind-address = :: # (all IP addresses permitted) 

Speichern und weiter gehts mit der Sicherheit. Den folgenden Befehl ausführen und die Fragen nach besten Wissen und Gewissen beantworten.

sudo mysql_secure_installation

Restart the database now

sudo /etc/init.d/mysql restart

Now to install the DB (more accurately, that is here (described). To do this, navigate to the Shinobi installation directory and start the client

cd /home/Shinobi
mysql

Nun die folgenden Zeilen ausführen

source sql/framework.sql;
source sql/user.sql;
exit;

Restart Shinobi

pm2 restart all
Shinobi im Browser nach erfolgreichen Superuser Login
Shinobi in the browser after successful Superuser login

Langames flipbook

The following page provides a few tips on how performance can be improved.

https://www.raspberrypi.org/forums/viewtopic.php?t=220699

Set GPU memory to 256MB

sudo nano /boot/config.txt

Increase GPU memory to 256MB

gpu_mem=256 or gpu_mem_256

A reboot is required.

I tried the whole thing on the PI4, as the hardware acceleration is supposed to be better here.

Miscellaneous

NVIDIA Jetson Nano

Der Einplatinencomputer Jetson Nano von NVidia soll in der Video- Verarbeitung besser sein. mit seinen rund 130€ ist er zwar mindestens doppel so teuer wie der PI4 soll aber bis zu 34 parallele Stream verarbeiten können. Hier ein Link zur Konfiguration.

https://hub.shinobi.video/articles/view/i1bbMtvqC2NO1B2

Conclusion

Es Klappt. Die Software macht was sie soll. Die Installation ist einfach, auch wenn ich die Datenbank bei mir nachträglich installieren und intialisieren musste.

The performance of the PI3 seems to be reaching its limits, especially as I have other processes running on it. The PI4 with 4MB has more reserves here.

Für kleinere Projekte mit wenigen Kameras und zum Testen der ESP Cams kann ich Shinobi auf dem PI empfehlen, besonders auch da sich die Investionen in Grenzen halten.

I will test other cameras with it as well. However, I doubt whether this combination will be my new NVR. I might have a look at the Jetson Nano. However, I'm more inclined to set up the Intel i5 from my old computer as a small server with Ubuntu.

Wenn ihr Anregungen oder zum Beispiel zur besseren Konfigurationen habt, lasst einen Kommentar da ich freue mich über jeden Beitrag, der keine Pillen verkaufen will 😉 . Auch wenn ihr Details braucht lasst eine Nachricht da ich werde versuchen den Beitrag zeitnah zu ergänzen.





Verwandte Beiträge

Sources

Manufacturer's page for Shinobi

Gute und kurze Einführung

Install MariaDB

Problemklärung bei Email Einstellungen

PI Optimisation

MJPEG Cam Hinzugügen

Error search

Shinobi with Jetson Nano

My Google Search

NVR programme list on GitHub

DateChangeAuthor
18.08.2020Post createdSuffocation

12 thoughts on “Raspberry PI als NVR mit Shinobi

  1. Hello,

    I have previously operated my two ESP32-Cams on a RasPi 3 with MotionEye as the software. However, MotionEye has been causing problems with motion-detection-controlled video recording for some time now, and, unfortunately, I cannot get the error fixed.

    I would like to try out some other (free) software on a RasPi 4 and I've seen that you've tested iSpy and Shinobi here.

    What's the difference?
    or.
    Which software is more recommendable?

    1. Hi, iSpy is for Windows, unfortunately with both I only tested the installation and didn't get any further. I use iSpy on Windows now and then to test a camera. I also still have Shinobi installed on the Pi, but I don't use it anymore.
      Hello
      Stefan

      1. Okay. Thanks.

        Today I tried to install the ISpy execution for RasPi (Agent DVR), without success. The prerequisites with OpenCV etc. are too high for me.

        I'll give Shinobi a try, then.

        1. Morning Gruen,

          I'm not currently using any, but I wanted to try Shinobi with the Nvidia Jetson Nano, but I haven't got around to it yet.
          Hello
          Stefan

  2. Hello Stefan,

    Thank you for the detailed instructions.
    Everything has run through so far, but unfortunately Shinobi can’t „find“ the „PM2“ command. Even when I try „pi@raspberry:~ $ PM2 restart all“ in the terminal, it reports: „bash: pm2: command not found…’
    Can you help me further? – As far as I've found out, it has something to do with node.js... but unfortunately, I don't quite understand the details 🙁

    I'd be grateful for any tips and ecstatic with a solution 😉

    Best regards from Vienna,
    Klaus“

  3. Hello Stefan,
    Unfortunately, that's not working with access to shinobi.
    "Shinobi process is not running" means that the Shinobi software, which is likely a video surveillance system, is not currently active or operating.
    I also cannot execute a Shinobi restart.
    I’ve also changed the port to 8081, but to no avail. The certificate doesn’t seem to be the problem; Edge says the address 192…:8080/super is unreachable. I’ve also got Open Media Vault running on the Raspberry Pi, and its interface can be accessed without any issues via the IP address.

    1. Hello Fritz

      Unfortunately, I can't say that definitively, but the fact that the Shinopi process isn't running is already an indication. I think it should be.
      I assume you've already checked the log and searched online for why the process might not be starting. I'd like to take a look at it myself, but I don't have time at the moment.
      However, what I can say is that it worked for me right away, and I also tried it on a PI3 and a PI4 with Open Media Vault (what a surprise, it just made sense :) ).
      I'm sorry I can't help with that.

      Hello
      Stefan

  4. Hello,
    I have received the message „Install Completed“.
    I am now supposed to log in to the browser at IP 192.168.....:8080/super. Unfortunately, I am denied access with the message „The connection to this WEB page is not secure“. Is the problem with my system or with Shinobi? I would appreciate some feedback.

Leave a Reply

Your email address will not be published. Required fields are marked *