#video-stream #video #recorder #rtsp #networking #nvr #enconding

bin+lib simple-network-video-recorder

A simple (NVR) to capture video stream into mp4 files without filling up the disk entirely!

3 releases

0.1.2 Apr 10, 2024
0.1.1 Apr 6, 2024
0.1.0 Apr 1, 2024

#45 in Multimedia

Download history 40/week @ 2024-03-26 287/week @ 2024-04-02 149/week @ 2024-04-09

476 downloads per month

Apache-2.0

15KB
228 lines

simple-network-video-recorder

A simple network video recorder (NVR) for you to capture your video stream into mp4 files without filling up your disk entirely!

Functionalities

It does two things:

  1. saves the contents of a RTSP stream into video segments (mp4) of fixed duration (this uses FFmpeg) and;
  2. the video segments total size never exceeds a threshold: the oldest video segment is deleted to make room for the new.

Installation

Please take a momment to read the LICENSE terms before going any further.

Warning! For now, you have to build your own binaries, since you need to setup a few environment variables first. I plan to fix this in the future by introducing a CLI.

Installation steps:

  1. You must have rust and ffmpeg already installed on your system. Please refer to rust-lang.org and ffmpeg.org on how to achieve this requirement;

  2. Clone this repository with git clone https://github.com/dancavolix/simple-network-video-recorder.git

  3. Change to the project root directory cd simple-network-video-recorder;

  4. Use cargo build --release to build the project locally.

Setup

Inside the root directory, copy the configuration file by running cp .env.example .env. Before running the app, you first need to set the values in the file .env. Here is short description of what is each one of those:

  • URI: the stream URI which is something like rtsp://username:password@192.168.x.y/cam/example;
  • SOURCE_ID: a name to better identify your files (in case of multiple streams). Avoid using spaces and special characters;
  • SAVE_DIR: the directory where segments will be stored into files, .e.g., SAVE_DIR=/home/user/my-videos;
  • SEGMENT_DURATION: the segment duration in seconds, e.g, set to 3600 for an hour long segments;
  • STORAGE_CAPACITY: how much disk space should the segments occupy in total, e.g., set 128000000000 (nine zeroes) for 128GB.

Warning! The value on SEGMENT_DURATION and STORAGE_CAPACITY are very important to be set right. You have to do your own experiments and find out what best suits your need, but notice the default settings (hour long segments and 128GB storage size will do just fine, considering you have this much free space in your disk).

Start recording

Simply run cargo run --release.

No runtime deps