This project reads multiple video streams (e.g. RTSP) and outputs low-latency DASH streams, accessible via a HTTP connection, viewable via a simple web interface. It handles many (>10) video streams with little without high CPU load if no video conversion is desired (e.g 4K -> 1080p or H265 -> H264).
Features
https://user-images.githubusercontent.com/1242917/178140875-1ed84e04-7654-4b87-99cf-374d834dbd03.mov
When a client connects to the website, the Node.js manager starts streaming from all video stream sources which you define in a configuration file. Using FFMPEG, the source streams are converted into DASH streams and temporarily stored in shared memory. NGINX serves the DASH files in the shared memory directly to your browser. Commands (PTZ, Pan Tilt Zoom) issued from your browser are forwarded to the Node.js Manager and sent to the camera.
+-------------------+ +-------------------+
| Docker Container | | Docker Container |
+----------+ | +--------+ +----------+ +--------+ | +-----------+
| Camera 1 +----|-->| FFMPEG +-->| | | |<-|---+ Browser 1 |
+----------+ | +--------+ | | | | | +-----------+
| | | | | | |
+----------+ | +--------+ | | | | | +-----------+
| Camera 2 +----|-->| FFMPEG +-->| /dev/shm |<--+ |<-|---+ Browser 2 |
+----------+ | +--------+ | | | | | +-----------+
| | | | | NGINX | |
+----------+ | +--------+ | | | | | +-----------+
| Camera 3 +----|-->| FFMPEG +-->| | | |<-|---+ Browser . |
+----------+ | +--------+ +----------+ | | | +-----------+
^ | | | | | | |
| | +-----------+ Ctrl Cmds | | | +-----------+
| PTZ | | Node.js |<---|---|-------+ |<-|---+ Browser N |
+----------+--+ Manager | | | | | | +-----------+
ONVIF | +-----------+ | | +--------+ |
+-------------------+ +-------------------+
docker-compose.prod.yml
template to wherever you want to deploy the application${DOCKER_NGINX_VERSION}
variable with your desired nginx versionconfig.toml
configuration filenginx/nginx.conf
and configure to your likingdocker-compose up -d
If you want to re-encode video streams, modify the ffmpeg-wrapper.sh
script to your requirements and bind-mount it into the backend container.
The application is configured using a .toml
or .json
configuration file (see example configuration in config.toml
).
The TOML and JSON format is equivalent, but the config.toml
file takes precedence over the config.json
file.
The configuration file must be mounted at /app/config.toml
in the backend docker container (see docker-compose.prod.yml
).
A complete description of the TOML/JSON schema can be found in src/server/ConfigParser.ts
.
.output_path
string
true
.sources[]
array
true
.sources[].id
string
true
.sources[].target_latency_secs
number
false
4
.sources[].rtsp{}
object
anyOf(.sources[].rtsp{}, .sources[].onvif{})
.sources[].rtsp{}.url
string
(see Connection Strings)true
.sources[].onvif{}
object
anyOf(.sources[].rtsp{}, .sources[].onvif{})
.sources[].onvif{}.url
string
(see Connection Strings)true
.sources[].onvif{}.profile
string
false
.sources[].onvif{}.protocol
string
, "UDP" | "TCP" | "RTSP" | "HTTP"
false
://
] [username [:
password] @
] hostname [:
port] [/
path] [?
query]encodeURIComponent("secret password") -> "secret%20password"
)mydomain.com
myproto://michael@mydomain.com
myproto://michael:secret%20password@mydomain.com:4634/some/path?some=args&more=args
./start.sh dev
-> Wait for the bash prompthttp://localhost
git-conventional-commits
git-conventional-commits version
git commit -am'build(release): bump project version to <version>'
git-conventional-commits changelog --release <version> --file 'CHANGELOG.md'
git commit -am'doc(release): create <version> change log entry'
git tag -a -m'build(release): <version>' '<version-prefix><version>'
git push