Numbers Prefer Multiplication
    Wondering what’s next for npm?Check out our public roadmap! »

    pi-camera-rtsp-server

    1.0.0 • Public • Published

    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.isActive()

    Checks if camera feed is active by the following conditions :

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

    camera.enable()

    Enable camera. Returns Promise

    camera.disable()

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

    Record

    new Record(file, overwrite, duration)

    • file (string) : file path + name.
      Absolute path required ; use $HOME instead of ~ when applicable.
    • overwrite (boolean) : delete duplicate if exists
    • duration (integer, optional) : automatically stop record after n seconds
      NOTE: record still can be manually stopped before defined duration.

    Record.start()

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

    Record.stop()

    Stop record.

    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.stopAll()

    Stop all active records.

    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.

    Keywords

    none

    Install

    npm i pi-camera-rtsp-server

    DownloadsWeekly Downloads

    1

    Version

    1.0.0

    License

    GPL-3.0-only

    Unpacked Size

    16.8 kB

    Total Files

    18

    Last publish

    Collaborators

    • avatar