Go to file
KaKi87 ab5f97b9e3 Not going to remove Record.elapsedTime 2019-10-14 11:47:07 +02:00
lib Not going to remove Record.elapsedTime 2019-10-14 11:47:07 +02:00
test Remove timeout from test 2019-10-11 15:05:35 +02:00
.gitignore Initial commit 2019-08-17 00:37:41 +02:00
README.md Remove duration (timeout) from docs 2019-10-11 15:05:25 +02:00
index.js pi-camera-rtsp-server v1.0.0 2019-09-27 10:38:36 +02:00
package.json pi-camera-rtsp-server v1.0.0 2019-09-27 10:38:36 +02:00
yarn.lock pi-camera-rtsp-server v1.0.0 2019-09-27 10:38:36 +02:00

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.