You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
KaKi87 ab5f97b9e3 Not going to remove Record.elapsedTime 4 days ago
lib Not going to remove Record.elapsedTime 4 days ago
test Remove timeout from test 6 days ago
.gitignore Initial commit 2 months ago
README.md Remove duration (timeout) from docs 6 days ago
index.js pi-camera-rtsp-server v1.0.0 3 weeks ago
package.json pi-camera-rtsp-server v1.0.0 3 weeks ago
yarn.lock pi-camera-rtsp-server v1.0.0 3 weeks ago

README.md

pi-camera-rtsp-server

Raspberry Pi camera RTSP server tested on Pi Zero W using OV5647 module.

Requirements

Hardware :

  • Raspberry Pi
  • Raspberry Pi compatible camera
  • Pi/camera compatible ribbon cable

System : up-to-date Raspbian

Setting : camera interface enabled from raspi-config

Software :

  • bash
  • nodejs
  • raspivid
  • cvlc from vlc
  • openRTSP from livemedia-utils

No NodeJS dependancies.

API

Camera

camera.config

Settings Object

  • port : RTSP server broadcasting port
    Default 8554
  • rotation : image rotation
    Default 0, available 90 180 270 (i.e. -90)

camera.getStatus()

Checks if camera feed is active by the following conditions :

  • raspivid (unique) process active
  • RTSP server port open

Returns Promise<Status{}>

Status object :

  • enabled (boolean) camera enabled
  • manually (boolean) camera enabled manually, without API
    Means camera cannot be properly disabled from API.

camera.enable()

Enable camera. Returns Promise

camera.disable()

Disable camera.
All active records will be stopped first.
Returns Promise

Record

new Record(file, overwrite)

  • file (string) : file path + name.
    Absolute path required ; use $HOME instead of ~ when applicable.
  • overwrite (boolean) : delete duplicate if exists.

Record.start()

Start record.
Camera will be enabled if not already active.
Returns Promise

Record.stop()

Stop record.
Returns Promise

Record.file

Record file path + name

Record.duration

Record duration

Record.pid

Record process PID (integer)

Record.startTime

Record start time (Date)

Record.stopTime

Record stop time (Date)

Record.elapsedTime

Record elapsed time in (integer, seconds)

Record.recording

Record active state (boolean)

static Record.startAll()

Start all non-started records.
Returns Promise

static Record.stopAll()

Stop all active records.
Returns Promise

static Record.records

All records (array of Record instances)

Unit testing

  • Make sure you have ffprobe binary from ffmpeg package
  • Install development dependancies : yarn install
  • Fill test/config.json with your video recording test folder
  • Disable camera (if enabled)
  • Run yarn test

Planned features

License

This project is licensed under GNU GPL v3.