Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4872

Graphics, sound and multimedia • Large Scale NVR

$
0
0
I'm exploring the feasibility of replacing a decent sized old NVR system with a several Pis and one or more NASs, leaving my notes here

First round of testing: MotionEye (the program, not the OS) saved on a network share from a Windows 10 PC

Using a headless Raspberry Pi 5 8MB, clean install of Bookworm 64-bit Lite from the Raspberry Pi Imager, install instructions adapted from the MotionEye repository

MotionEye Install

Get latest version of OS

Code:

sudo apt-get updatesudo apt-get upgrade -y
Install various dependencies

Code:

sudo apt --no-install-recommends install ca-certificates curl python3 python3-dev libcurl4-openssl-dev gcc libssl-dev -y
Install Pip and bypass the virtual environment requirement

Code:

curl -sSfO 'https://bootstrap.pypa.io/get-pip.py'grep -q '\[global\]' /etc/pip.conf 2> /dev/null || printf '%b' '[global]\n' | sudo tee -a /etc/pip.conf > /dev/nullsudo sed -i '/^\[global\]/a\break-system-packages=true' /etc/pip.confsudo python3 get-pip.pyrm get-pip.py
Install MotionEye

Code:

sudo python3 -m pip install --pre motioneyesudo motioneye_init
Create credentials file for network share

Code:

nano ~/.smbcredentials
Add in credentials set up on the Windows 10 PC for the network share, add username and password after the equals signs
username=
password=
Set permissions on that credentials file

Code:

chmod 0600 ~/.smbcredentials
Set up automounting that the Windows share on startup, I put it as a subdirectory of the default MotionEye recording location

Code:

sudo nano /etc/fstab
Add to the end of the file, replace the 3 instances of "pi" with the username if it's different
//<IP Address of File Share>/<Path of File Share> /var/lib/motioneye/NetworkShare cifs credentials=/home/pi/.smbcredentials,x-systemd.automount,iocharset=utf8,uid=pi,gid=pi,file_mode=0777,dir_mode=077700
Reboot to get everything up and running

Code:

sudo reboot now
MotionEye has a web interface access on port 8765 using it's IP address or pi.local, ex http://192.168.0.8:8765 or pi.local:8765

Default username is "Admin" with no password, change that after first login

Camera setup

I'll be using Axis Communications cameras. First up with is a P3228-LV, max resolution 3840x2160, goal is a quality 15 fps video

Most of their cameras allow you to get a straight mjpg video feed using a web browser at http://<IP Address>/axis-cgi/mjpg/video.cgi

MotionEye doesn't seem to like the mjpg feed, so moving on to h264 RTSP feeds at rtsp://<IP Address>/axis-media/media.amp

Trying some different configurations
/axis-media/media.amp?audio=0&videocodec=h264&resolution=3840x2160&fps=15&camera=1&compression=00
/axis-media/media.amp?audio=0&videocodec=h264&resolution=3840x2160&fps=15&camera=1&compression=30
/axis-media/media.amp?audio=0&videocodec=h264&resolution=3840x2160&fps=15&camera=1&compression=50
/axis-media/media.amp?audio=0&videocodec=h264&resolution=3840x2160&fps=15&camera=1&compression=80

Starting out with continuous recording at 15 fps, 60 second segments, no motion detection, full quality output from the Pi with mp4 output. Picture quality came out good on all of them except the 80% compression, which was still OK. Frame rate was bad on all except the 30% compression, where it was just OK. File size didn't vary that greatly, uncompressed was around 1.2 GB per minute, the 30% compression was around 800 MB per minute

The camera also supports Onvif, RTSP feed at rtsp://<IP Address>/onvif-media/media.amp

Onvif settings can be changed through the camera web interface, log in to the camera's IP address in a web browser. You need to set up an Onvif user, and use that user and password instead of the camera credentials when setting up feed in MotionEye

The default h264 profile is at 4k, 30 fps video with 70% quality (I'm assuming 30% compression, as 30% compression is the default on other feeds) and can be accessed at
/onvif-media/media.amp?audio=0&profile=profile_1_h264

I'm still only setup to grab at 15 fps, even though the feed is set at 30 fps. Performance was roughly the same as the 30% compression, I'm going to stick with the Onvif feed for continued testing, along with a 30 fps feed recording at 15 fps.

Major issue at this point, each 60 second video has about 2 seconds of freeze at the start, at which point it jumps ahead. Hopefully this will be fixed with motion detection and some pre-roll. Switching format from mp4 to mkv didn't have any major effects, and I'm gonna stick with mkv going forward because I read something somewhere once.

Adding motion recording killed the frame rate on the 4k feed, so I'll drop it down to 1080p. I changed "profile_1_h264" settings in the camera from 4k to 1080p, as well as on the MotionEye end. Picture quality is still pretty solid, frame rate is good even with motion. File size is pretty variable, from around 200 MB up to 1 GB per minute of video.

So finished product is an Onvif feed at 1080p and 30 fps, recorded as a mkv file at 1080p and 15 fps. Next step will be adding more cameras to see what a single pi can handle

Statistics: Posted by RyanS — Thu May 23, 2024 6:55 pm



Viewing all articles
Browse latest Browse all 4872

Trending Articles