Motion Detection

If your shinobi-motion.js plugin is crashing try : setting the dimenions to 320x240. Pressing save, then modifying your regions if you have to and once again saving the settings.

Install Cario2 on Ubuntu / Debian

Cairo2 is the base engine used for detection.

  1. Install libraries

    sudo apt-get install libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev build-essential g++

Install Cario2 on CentOS / Fedora

  1. Install libraries

    sudo yum install cairo-devel libjpeg-turbo-devel giflib-devel -y
  2. Try this only if installing the plugin fails

    yum groupinstall "Development tools"

Install the Shinobi Plugin

  1. Navigate to your Shinobi directory and install the node.js wrappers needed to run the plugin.

    sudo npm install [email protected] moment
  2. Setup the configuration file for the plugin.

    cp plugins/motion/conf.sample.json plugins/motion/conf.json
  3. OPTIONAL : Modify the conf.json to match your current listening port. Default is 8080.

    nano plugins/motion/conf.json
  4. Check that your main configuration file, for the main Shinobi app, has a Plugin Key set. If one is not set the plugin will not work. You may review conf.sample.json to see the default setup.

    nano conf.json
  5. Start the Motion plugin

    pm2 start plugins/motion/shinobi-motion.js
  6. When complete you will see Detector : Motion Connected in your Monitor Settings. Shinobi does not need to be restarted unless you modified the PluginKeys in conf.json

Once Installed

Important information to note are as follows.

  • UI Element > Motion Meter : When motion occurs a red bar will appear under your stream to indicate how much motion has happened.

  • Monitor Settings > Detector > How to Record : This chooses how the detector engine will choose to create or keep videos for review.

  • Monitor Settings > Detector > How to Record > Hotswap Modes : Monitor should be set to Watch-Only. Records when motion is found. By default it will record for 10 minutes then switch back to Watch-Only. This method does not have buffer frames. To get some frames before a specific event you can try using "Delete Motionless" instead.

  • Monitor Settings > Detector > How to Record > Delete Motionless Video : Monitor should be set to Record. This records all the time, Checks if motion happened when the segment closes and then deletes it if no motion is found.

  • Monitor Settings > Detector > Send Frames : Enabling this will push frames to your detection plugin for analyzation.

  • Monitor Settings > Detector > Indifference : The opposite of sensitivity. Until what level of confidence should the plugin allow motion until setting off a trigger. This is also the global indifference value.

  • Monitor Settings > Detector > Region Editor > Indifference : If this value is left blank the global indifference value will be used.

Why aren't plugins just integrated?

Not everyone uses motion detection or object tracking and the libraries required can be bothersome to install, based on the OS. For example if I make shinobi-opencv.js a feature then everyone will be required to install OpenCV just to use basic features in Shinobi. This also allows us to swap the plugin with a custom one or run it on another machine entirely. Sharing the work between multiple machines can be a great way to optimize performance.