Shinobi

From ArchWiki
Jump to navigation Jump to search

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 and ffmpeg-shinobiAUR. Users of Arch ARM may simply install with pacman as these two packages are provided in the official repos.

Warning: One can alternatively use ffmpeg but there are known incompatibilities with version 4.4 of ffmpeg which introduce CPU saturation so it is highly recommended to use the aforementioned AUR version.
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 -u root -p
   <<enter the mariadb root password assigned in the first step>>
> CREATE DATABASE ccio; flush privileges; \q

Setup Shinobi

Create the user and setup database framework: First substitute 127.0.0.1 with the LAN IP address of the server. For example, if this 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
# mysql < /tmp/user.sql
# mysql ccio < /usr/share/shinobi/sql/framework.sql

Next, edit /etc/shinobi/conf.json changing both instances of 127.0.0.1 to match the actual IP address of the server.

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. Browse to http://192.168.9.100: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://192.168.9.100:8080 and log in as the non-admin user.

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