A lightweight DVR service built with Node.js + FFmpeg for:
- live HLS streaming from RTSP cameras;
- archive playback by time range;
- MP4 archive export;
- automatic retention cleanup using
retentionDays.
Repository: https://github.com/rosteleset/Simple-DVR.git
- Starts one
ffmpegprocess per camera fromconfig.json. - Stores segments in
/var/dvr/<camera>/YYYY-MM-DD/HH/*.m4s. - Serves live and archive playlists over HTTP.
- Generates minute preview clips.
- Runs cleanup in a dedicated worker thread (
cleanup-worker.js).
- Copy the config template:
cp config.example.json config.json-
Update RTSP URLs and camera settings in
config.json. -
Install dependencies:
npm init -y
npm install express- Run:
node server.jsGET /:camera/live.m3u8(aliases:index.m3u8,video.m3u8,*.fmp4.m3u8)GET /:camera/dvr.m3u8?start=<ISO>&end=<ISO>GET /:camera/index-:timestamp-:duration.fmp4.m3u8GET /:camera/archive-:from-:duration.mp4GET /:camera/recording_status.jsonGET /:camera/:yyyy/:mm/:dd/:HH/:MM/:SS-preview.mp4GET /dvr/...direct DVR file access via nginx alias
For full API and deployment details, see INSTALL.md.
See config.example.json.
Key parameters:
segmentDuration: HLS segment duration (seconds)liveWindow: live window size (segments)cleanupIntervalMinutes: cleanup intervalcameras[]: camera list (name,rtsp,retentionDays,disableAudio)
If you run this as a service, verify:
WorkingDirectorypoints to the real project directory.ExecStartpoints to the realserver.jspath.
Licensed under LICENSE.