simple-network-video-recorder

Crates.iosimple-network-video-recorder
lib.rssimple-network-video-recorder
version0.1.2
sourcesrc
created_at2024-04-01 22:11:18.225012
updated_at2024-04-10 12:16:27.771578
descriptionA simple (NVR) to capture video stream into mp4 files without filling up the disk entirely!
homepage
repositoryhttps://github.com/dancavolix/simple-network-video-recorder
max_upload_size
id1192993
size26,483
(dancavolix)

documentation

README

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.

Commit count: 33

cargo fmt