This package has been deprecated

Author message:

abandoned and unmaintained

cycle-onvif-stream-driver

1.0.5 • Public • Published

cycle-onvif-stream-driver

A Cycle.js driver for receving stream urls from ONVIF compatible IP cameras.

installation

Install with NPM

npm install --save cycle-onvif-stream-driver

sample

See samples/.

usage

Import into your node code:

const makeONVIFStreamDriver = require('cycle-onvif-stream-driver')

Register the driver:

const drivers = {
  ...
  ONVIF: makeONVIFStreamDriver({
    command: `${__dirname}/sudo_arp_scan.sh`, // You can omit this if you have correct permission
    user: 'admin',
    pass: 'admin'
  })
}

Request format for sockets sink:

{
  category: 'category',
  interface: 'wlp5s0'
}

For example:

sources.ONVIF.select('category')

Sample output:

[{  ip: '10.17.96.125',
    mac: '...',
    vendor: '...',
    timestamp: ...,
    stream: 'rtsp://...',
    fps: 15 }]

passwords and ports

The user and pass keys determine the default authentication details for your IP cameras. However if certain devices have specific or different passwords, you can always pass in a JSON object with the appropriate values for user and pass. You can do the same for devices with non-standard ONVIF ports (default is port 80).

const drivers = {
  ...
  ONVIF: makeONVIFStreamDriver({
    ...
    passwords: {
      '10.17.96.125': {
        user: 'admin2',
        pass: 'admin',
        port: 8899
      },
      '10.17.96.126': {
        user: 'admin',
        pass: '12345'
      }
    },
    user: 'admin',
    pass: 'admin'
  })
}

detection

This driver makes use of ARP requests instead of SOAP requests to detect cameras as this is able to detect more cameras than the underlying ONVIF library can. The detection makes use of arp-scan, which has to be installed and configured beforehand. As you'll most likely want to be able to run the script as a regular user, you may have to allow your user to execute arp-scan without a password. This can be acheived by configuring your sudoers file as below.

configure sudo

Run visudo -f /etc/sudoers.d/arp-scan and add the following, where $user is your username.

$user ALL = NOPASSWD: /usr/bin/arp-scan

After configuring this, you will still need a setup similar to that in samples/ to execute arp-scan with sudo prefixed to it.

discover multiple subnets

By default, the arpscan library is set up to only discover IPs on the local subnet. The driver can be configured to discover multiple subnets by passing an args list:

const drivers = {
  ONVIF: makeONVIFStreamDriver({
    ...
    args: ['10.17.96.0/24', '192.168.191.0/24'],
    ...
  })
}

override with password array

If you want to manually add a device from outside your detection subnet, you can make define it in the passwords array and set a password_override key as true in the driver settings. This will still enable ONVIF capabilities of the device such as stream detection without having to rely on the driver to detect the device.

const drivers = {
  ONVIF: makeONVIFStreamDriver({
    ...
    password_override: true,
    passwords: {
      '192.168.0.2': {
        user: 'admin',
        pass: 'admin',
        port: 10080
      }
    },
    ...
  })
}

Readme

Keywords

Package Sidebar

Install

npm i cycle-onvif-stream-driver

Weekly Downloads

1

Version

1.0.5

License

MIT

Last publish

Collaborators

  • timurkiyivinski