PRISM
NodeJS capture / logging / streaming server for MJPEG-based IP cameras
Requirements
- Node v0.6 (if it's simple to fix it up for v0.4, let me know)
- avconv with libx264 support for converting mjpeg videos to mp4
- systemd to use the service script in this file
Installation
- Clone the repository
- Run
npm install
inside the project folder - Create a folder to store log items (for instance,
/mnt/cctv
) - Copy the
config.js.example
file toconfig.js
and edit it to suit your environment - Optionally create a systemd configuration for the service
- Set the cron task to convert mjpeg logs to mp4
Configuration
config.js
parameters:
config.webPort
- the port your web server will run on.config.logLevel
- the Winston logging level. Defaults toinfo
.config.logPath
- the location on disk to save captured images.config.cameras
- an array containing an object for each camera in the system:name
- a unique identifier for the camera. Must not contain spaces or characters that might break your filesystem.description
- a friendly description for the camera. Presented in the cameras JSON listing.url
- the URL of the IP camera's MJPEG stream.user
- the username of the camera.password
the password of the camera.sendImmediately
- passed through to Node's request:sendImmediately
defaults totrue
, which causes a basic or bearer authentication header to be sent. IfsendImmediately
isfalse
, then request will retry with a proper authentication header after receiving a401
response from the server (which must contain aWWW-Authenticate
header indicating the required authentication method).motion
- whether to only emit frames from the camera when motion is detected.log
- whether to log this camera or not.
logDelta
- the elapsed time between logging frames. Because cameras send out frames as fast as they can, and node is event-based, this does not necessarily correlate to a set frames-per-second value.