|
||
---|---|---|
lib | ||
test | ||
.gitignore | ||
README.md | ||
index.js | ||
package.json | ||
yarn.lock |
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
fromvlc
openRTSP
fromlivemedia-utils
No NodeJS dependancies.
API
Camera
camera.config
Settings Object
port
: RTSP server broadcasting port
Default8554
rotation
: image rotation
Default0
, available90
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 enabledmanually
(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 fromffmpeg
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
- pause/resume recording (using video file concatenation with ffmpeg demuxer method)
- enhance camera status detection (e.g. in use by another executable than
raspivid
)
License
This project is licensed under GNU GPL v3.