3 releases
0.1.2 | Apr 10, 2024 |
---|---|
0.1.1 | Apr 6, 2024 |
0.1.0 | Apr 1, 2024 |
#79 in Multimedia
23 downloads per month
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:
- saves the contents of a RTSP stream into video segments (mp4) of fixed duration (this uses FFmpeg) and;
- 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:
-
You must have
rust
andffmpeg
already installed on your system. Please refer to rust-lang.org and ffmpeg.org on how to achieve this requirement; -
Clone this repository with
git clone https://github.com/dancavolix/simple-network-video-recorder.git
-
Change to the project root directory
cd simple-network-video-recorder
; -
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 likertsp://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 to3600
for an hour long segments;STORAGE_CAPACITY
: how much disk space should the segments occupy in total, e.g., set128000000000
(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
.