Shinobi

From ArchWiki

Shinobi is a modern, Open Source NVR (Network Video Recorder) written in Node.js. For personal or educational use, the Pro version does not require a license key. See this page if the intended use is for commercial purposes.

A note about h.265 video

Note: Cameras supporting h.265 cannot be viewed in browsers on the Shinobi Dashboard. Recording (copy video) will still work but if the intention is to use a browser to view, this is not possible. One can use the mobile app to view these streams.

Installation

Install shinobi-gitAUR.

Warning: Early versions of ffmpeg from the relase/4.4 branch were known to cause incompatibilities with shinobi resulting in CPU saturation of ffmpeg processes. These issues seem fixed with the n4.4.1 release of ffmpeg. Users experiencing problems should use ffmpeg-shinobiAUR which supplies the latest stable release from the release/4.3 branch of ffmpeg and is known run as expected.
Note: Shinobi will be running as a non-privileged user not as root which is how upstream expects node to run. A few limitation are imposed as a result:
  1. Installation of plugins from the webUI will not work. Manually start the server as root if these are needed.
  2. The restart feature from the webUI will not work since pm2 is not being used.
  3. Binding to ports <1000 will not work, as only root can do so. This is only relevant if using FTP or SMTP to receive motion/object detection. See #Motion/object detection from within the camera for a several work around options.

Setup

Install and set up the MariaDB server

Refer to MariaDB#Installation for initial setup, then use the following commands to create a database for Shinobi:

# mysql
> CREATE DATABASE ccio; flush privileges; \q

Create Shinobi's user majesticflame and grant it all privileges to the new database:

# mysql < /usr/share/shinobi/sql/user.sql
Note: shinobi-gitAUR depends on mariadb, so MariaDB will be installed on the same server as Shinobi. However if you installed Shinobi manually or without the mariadb dependency with MariaDB installed on a seperate server, then you will need to copy and modify /usr/share/shinobi/sql/user.sql as needed if, for example, your LAN IP is 192.168.9.100.
$ sed 's/127.0.0.1/192.168.9.100/g' < /usr/share/shinobi/sql/user.sql > /tmp/user.sql

Then copy the file to your MariaDB server with scp or any other mechanism then running the modified sql file:

# mysql < /tmp/user.sql

Finally populate the database with tables:

# mysql ccio < /usr/share/shinobi/sql/framework.sql

Setup Shinobi

Note: If MariaDB is on a seperate server, edit /etc/shinobi/conf.json and replace 127.0.0.1 under db.host.

Customize /etc/shinobi/conf.json as desired.

Optionally setup the mail section accordingly as well as replacing the cron key with something random as indicated in the comments.

Optionally change the the super admin password by editing /etc/shinobi/super.json and replacing the value for "pass" with an md5sum hashed password. Generate one like this:

echo -n PASSWORD | md5sum

Start and Enable shinobi with the shinobi.target unit. shinobi.target will start/stop shinobi-camera.target and shinobi-cron.service. Browse to http://localhost:8080/super to perform initial setup including creating a user/users. See the official configure guide for a walk-through. Once finished, browse to http://localhost:8080 and log in as the non-admin user.

Note: Replace localhost with a LAN IP if on a separate computer.

Android and iOS apps

Shinobi Mobile Apps for both Android and iOS are available though this public test.

Tips and tricks

Delay between camera video and Shinobi

Some level of a lag or delay between the camera and the Shinobi dashboard is normal and dependent on stream type and video settings. See this article for some tips on minimizing the delay.

Motion/object detection natively in Shinobi

Shinobi can monitor a video feed and only record if motion is detected. Full frame or trigger areas are natively supported. See the setting-up-motion-detection article of upstream's docs.

Motion/object detection from within the camera

Some camera manufactures offer native motion/object detection within the firmware of the camera itself. Shinobi can accept external event to trigger a record when motion is detected by the camera and these events are communicated by either SMTP or FTP.

Note: Adjustment to a higher value to the Segment length variable might be needed if there is a lag between when the camera detects motion and when Shinobi triggers the start of video. To test this, simply watch the live stream while someone triggers motion. Observe the time from the camera's clock when the motion was triggered and compare that to the video. Set a higher value and test again.

Since our package is not running node as root, it cannot use the native ports for these services (25 for STMP and 21 for FTP).

It is recommended to simply select a port above 1,000 for these services on Shinobi and within the camera.

If using the native ports is a hard requirement, use a Systemd#Drop-in files for shinobi-camera.service:

[Service]
AmbientCapabilities=CAP_NET_BIND_SERVICE

Resources