NVR (Network Video Recorder) is a network-based device used to record and store video data from IP cameras. Unlike traditional DVRs, NVRs process video digitally, offering better image quality and enhanced data processing. NVRs receive video from IP cameras over a network, then compress, store, and manage the data. Users can remotely access and control the system via the network.
Technical Parameters
- Video Input: NVRs support various video input interfaces, including analog, digital, and IP video.
- Video Compression: NVRs offer multiple video compression formats, such as H.264, MPEG-4, and MJPEG, allowing for flexible selection based on needs.
- Storage Capacity: NVRs accommodate various storage media like hard drives, SD cards, and USB flash drives, with expandable storage as needed.
- Network Interface: NVRs provide multiple network interfaces, including wired and wireless ports, enabling remote access and control.
- Video Output: NVRs support various video output interfaces compatible with different monitor types, including VGA, HDMI, and BNC.
NVR Advantages
- High-Definition Quality: The NVR system supports HD video recording, delivering clearer and more detailed monitoring images.
- Network Management: Users can remotely access and manage the NVR system, enabling 24/7 monitoring from anywhere.
- Enhanced Security: The NVR system includes video encryption and permission control to safeguard video data.
- Scalability: The NVR system supports multi-channel input and networking between multiple NVRs, allowing flexible expansion of the monitoring system.
How to build an NVR system?
1. First, you need to prepare a Neardi RK3588 embedded computer and update it to the latest firmware.
Create an nvr directory and clone moonfire-nvr, as shown below.
mkdir nvr
cd nvr
git clone https://github.com/scottlamb/moonfire-nvr.git
1.) sudo apt-get install build-essential libsqlite3-dev pkgconf sqlite3 tzdata curl
2.) curl -fsSL https://deb.nodesource.com/setup_21.x | sudo -E bash – && sudo apt-get install -y nodejs
3.) sudo apt install cargo npm
Enter the nvr/moonfire-nvr/server directory and execute the following commands:
neardi@LPA3588:~/nvr/moonfire-nvr/server$ cargo test
neardi@LPA3588:~/nvr/moonfire-nvr/server$ cargo build –release
neardi@LPA3588:~/nvr/moonfire-nvr/server$sudo install-m 755 target/release/moonfire-nvr /usr/local/bin
neardi@LPA3588:~/nvr/moonfire-nvr/server$ cd ..
For reference: https://github.com/scottlamb/moonfire-nvr/blob/master/guide/build.md
After successful compilation, the following figure is shown:
Enter the moonfire-nvr/ui directory and execute the following commands:
neardi@LPA3588:~/nvr/moonfire-nvr/ui$ npm install
neardi@LPA3588:~/nvr/moonfire-nvr/ui$ npm run build
neardi@LPA3588:~/nvr/moonfire-nvr/ui$ sudo mkdir /usr/local/lib/moonfire-nvr
neardi@LPA3588:~/nvr/moonfire-nvr/ui$ cd ..
neardi@LPA3588:~/nvr/moonfire-nvr/ui$ sudo rsync –recursive –delete —
chmod=D755,F644 ui/dist/ /usr/local/lib/moonfire-nvr/ui
After successful compilation, as shown in the above figure:
1.) Add the moonfire-nvr user, as follows:
$ sudo useradd –user-group –create-home –home /var/lib/moonfire-nvr moonfire
nvr
2). Create the moonfire-nvr configuration file
sudo vim /etc/moonfire-nvr.toml, add the following content:
[[binds]]
ipv4 = “0.0.0.0:8080”
allowUnauthenticatedPermissions = { viewVideo = true }
[[binds]]
unix = “/var/lib/moonfire-nvr/sock”
ownUidIsPrivileged = true
3.) Initialize moonfire-nvr
Execute the following command:
neardi@LPA3588:~/nvr/moonfire-nvr$ sudo -u moonfire-nvr moonfire-nvr init
7. Configure Camera
First, make sure moonfire-nvr cannot be stopped, otherwise the camera cannot be configured. For how to start and stop the moonfire-nvr service, please refer to Section 8.
Execute the following command in the terminal to open the moonfire-nvr UI to configure the camera:
neardi@LPA3588:~/nvr$ sudo -u moonfire-nvr moonfire-nvr config 2>debug-log
Configure video storage path
1.) Select “Directories and retention” from the menu, configure the video storage path, enter: /var/lib/moonfire-nvr/sample, as follows:
Add cameras
Return to the main menu, select Here, 2 network cameras are added, as follows:
Here, 2 network cameras are added, as follows:
Add users
Return to the main menu, select “Users”, as follows:
The following method and steps are used to create and start the service:
sudo vim /etc/systemd/system/moonfire-nvr.service, add the following:
[Unit]
Description=Moonfire NVR
After=network-online.target
# If you use an external hard drive, uncomment this with a reference to the
# mount point as written in `/etc/fstab`.
# RequiresMountsFor=/media/nvr
[Service]
ExecStart=/usr/local/bin/moonfire-nvr run
Environment=TZ=:/etc/localtime
Environment=MOONFIRE_FORMAT=systemd
Environment=MOONFIRE_LOG=info
Environment=RUST_BACKTRACE=1
Type=notify
# large installations take a while to scan the sample file dirs
TimeoutStartSec=300
User=moonfire-nvr
Restart=on-failure
CPUAccounting=true
MemoryAccounting=true
BlockIOAccounting=true
[Install]
WantedBy=multi-user.target
After that, execute the following command to start this service:
neardi@LPA3588:~/nvr$ sudo systemctl daemon-reload
neardi@LPA3588:~/nvr$ sudo systemctl enable –now moonfire-nvr
The following command is to start/stop the moonfire-nvr service:
neardi@LPA3588:~/nvr$ sudo systemctl start moonfire-nvr
neardi@LPA3588:~/nvr$ sudo systemctl stop moonfire-nvr
After starting the moonfire-nvr service, you can open the device IP address in the browser (google chrome/Microsoft Edge) to verify whether it is successful (according to your actual rk3588 device IP, here is 10.62.254.237)
http://rk3588_ip:8080, The successful results are as follows:
9. Display Camera video stream
View the camera video stream directly on the device
Here, first install the browser on the RK3588 device, as follows:
sudo apt install chromium-browser
Then open the terminal on the RK3588 desktop and enter the following command:
chromium, as follows:
This will open the browser, enter http://127.0.0.1:8080 in the browser address, as follows:
View the camera video stream on the PC
Make sure the PC and RK3588 are in the same LAN, and the browser operation steps are the same as on the device.
10. View saved video streams
Enter the IP address of the RK3588 device in the browser, http://rk3588_ip:8080, and the following interface will appear.
Check 1, then click 2 to view the saved video stream, as shown above: