Re: Raspberry pi3 and h264_mmal
Chris
Code: Select all
resizer -> splitter output 0 -> directbuffer
splitter output 1 -> h264 encoder -> mvect_buffer.
Code: Select all
#Fix zmpkg.pl error with zmsystemctl.pl
cd scripts
sed -i -- '/systemdRunning.*calledBysystem/,+3d' zmpkg.pl.in
cd ..
Code: Select all
avcodec --> h264encoder -->mvect_buffer
avcodec --> resizer -->directbuffer
Code: Select all
avcodec -->splitter -> resizere -> h264 encoder -> mvect_buffer
|
-------> resizerd -> directbuffer
Code: Select all
sudo apt-get update
sudo apt-get dist-upgrade
Code: Select all
sudo apt-get install zoneminder
Code: Select all
sudo usermod -a -G video pi
sudo usermod -a -G video www-data
Code: Select all
sudo apt-get install libmp4v2-2
sudo apt-get install libapache2-mod-fcgid
sudo apt-get install libexpect-perl
sudo apt-get install netpbm
sudo apt-get install php-gd
sudo apt-get install libssl-dev
Code: Select all
sudo apt-get remove zoneminder
sudo apt-get remove libjpeg8
Code: Select all
sudo apt-get build dep libjpeg62-turbo
Code: Select all
dh_auto_configure -- --with-build-date=$(DEB_VERSION) $(DISABLE_SIMD) --with-jpeg8
Code: Select all
usr/lib/arm-linux-gnueabihf/libjpeg.so.8*
Code: Select all
debuild -us -uc -b
Code: Select all
sudo dpkg -i ./libjpeg-dev_1.5.1-2_all.deb
sudo dpkg -i ./libjpeg62-turbo-dev_1.5.1-2_armhf.deb
sudo dpkg -i ./libturbojpeg0-dev_1.5.1-2_armhf.deb
sudo dpkg -i ./libjpeg62-turbo_1.5.1-2_armhf.deb
sudo dpkg -i ./libturbojpeg0_1.5.1-2_armhf.deb
sudo dpkg -i ./libjpeg-turbo-progs_1.5.1-2_armhf.deb
Code: Select all
sudo apt-get install git
sudo apt-get install cmake
mkdir raspberrypi
cd raspberrypi
git clone https://github.com/raspberrypi/userland.git
cd userland
./buildme
Code: Select all
sudo nano /lib/systemd/system/zoneminder.service
Code: Select all
# ZoneMinder systemd unit file
# This file is intended to work with all Linux distributions
[Unit]
Description=ZoneMinder CCTV recording and security system
After=network.target mysql.service apache2.service
Requires=mysql.service apache2.service
[Service]
User=www-data
Type=forking
ExecStart=/usr/bin/zmpkg.pl start
ExecReload=/usr/bin/zmpkg.pl restart
ExecStop=/usr/bin/zmpkg.pl stop
PIDFile=/var/run/zm/zm.pid
[Install]
WantedBy=multi-user.target
Code: Select all
sudo nano /etc/tmpfiles.d/zoneminder.conf
Code: Select all
d /var/run/zm 0755 www-data www-data
d /var/tmp/zm 0755 www-data www-data
Code: Select all
sudo chmod 755 /etc/tmpfiles.d/zoneminder.conf
Code: Select all
sudo /bin/systemd-tmpfiles --create /etc/tmpfiles.d/zoneminder.conf
Code: Select all
sudo systemctl enable zoneminder.service
Code: Select all
sudo a2enmod cgi
sudo a2enmod rewrite
sudo systemctl reload apache2
Code: Select all
sudo a2enconf zoneminder
sudo systemctl reload apache2
Code: Select all
sudo nano /etc/php/7.0/apache2/php.ini
sudo chown -R www-data:www-data /usr/share/zoneminder/
Code: Select all
mysql < /usr/share/zoneminder/db/zm_create.sql
mysql -e "grant select,insert,update,delete,create on zm.* to 'zmuser'@localhost identified by 'zmpass';"
Code: Select all
sudo mysql -uroot
use zm;
ALTER TABLE Monitors modify column Type enum('Local','Remote','File','Ffmpeg','Ffmpeghw','Libvlc','cURL') NOT NULL default 'Local';
ALTER TABLE MonitorPresets modify column Type enum('Local','Remote','File','Ffmpeg','Ffmpeghw','Libvlc','cURL') NOT NULL default 'Local';
ALTER TABLE Controls modify column Type enum('Local','Remote','Ffmpeg','Ffmpeghw','Libvlc','cURL') NOT NULL default 'Local';
alter table Monitors modify column Function enum('None','Monitor','Modect','Mvdect','Record','Mocord','Nodect') NOT NULL default 'Monitor';
Code: Select all
sudo dpkg -i ./zoneminder.deb
Code: Select all
sudo dpkg --remove --force-remove-reinstreq zoneminder
Code: Select all
sudo chmod 740 /etc/zm/zm.conf
sudo chown root:www-data /etc/zm/zm.conf
Code: Select all
sudo ufw allow http
Code: Select all
sudo chown -R www-data:www-data /usr/share/zoneminder/
Code: Select all
sudo chown -R www-data:www-data /var/cache/zoneminder/
Code: Select all
ZM_PATH_SWAP=/tmp
Code: Select all
sudo systemctl reload apache2
sudo service zoneminder restart
Code: Select all
Select Ffmpeg and Mvdect for software h264 decoding via ffmpeg with motion vector extraction.
Select Ffmpeghw and Mvdect for hardware h264 decoding via ffmpeg using mmal and motion vector extraction via hardware mmal h264 encoder.
Code: Select all
Source path = rtsp://mysv3c.chris.net/12
Remote Method = TCP
Capture width = 640
Capture height = 360
Source path = rtsp://mysv3c.chris.net/11
Remote Method = TCP
Capture width = 1280
Capture height = 720
Code: Select all
Click the Zones associated with the Monitor and Select Alarm Check Method as "AlarmPixels"
Code: Select all
Camera is set at 15 fps on its web UI. //Lower this value to solve problems with buffer overruns.
Source Type = Ffmpeghw
Function = Mvdect
Enabled = checked
Reference Image Blend %ge = No Blending
Alarm Reference Image Blend %ge = No blending (Alarm lasts forever)
Source path = rtsp://mysv3c.chris.net/12
Remote Method = TCP
Target Colorspace = 24 bit color
Capture width = 640
Capture height = 360
Image Buffer size = 20 // Since I started using an external USB drive for storing events, this number has seemed adequate
Warm Up frames = 0
Pre Event Image Count = 1 //All JPEGs are created in the capture process.
Post Event Image Count =60 //increase to have longer events instead of many short ones
Stream Replay Image Buffer = 200
Alarm Frame Count =1 //1 alarm frame is alert only, 2 alarm frames mean record the event as an alarm.
Storage Tab:
Save JPEGs: Frames only.
Video Writer: H264 Camera Passthrough
Zoneminder Config
WATCH_MAX_DELAY = 10
WATCH_CHECK_INTERVAL = 20
OPT_ADAPTIVE_SKIP = checked
CREATE_ANALYSIS_FRAMES = unchecked
Code: Select all
Set Reference Image Bled %ge to No Blending.
Set Alarm Reference Image Blend %ge to No blending.
Code: Select all
sudo apt-get install ccache
sudo apt-get install build-essential fakeroot devscripts
Code: Select all
sudo apt-get install libnetpbm10-dev
sudo apt-get install libvlccore-dev
sudo apt-get install libgcrypt11-dev
sudo apt-get install libssl-dev
sudo apt-get build-dep zoneminder
Code: Select all
git clone https://github.com/cmisip/ZoneMinder.git
cd ZoneMinder
Code: Select all
git checkout master
Code: Select all
cp -rf distros/debian ./
Code: Select all
git submodule update --init --recursive
Code: Select all
sudo apt-get update
Code: Select all
cd cmake
cmake ../
cd ..
debuild --prepend-path=/usr/lib/ccache -us -uc -b
Code: Select all
PIDSTAT zmc : Reporting average of 12 readings at 5 seconds intervals
ZMC Process ID : 27301 ==> ( 15.40 + 14.60 + 14.00 + 14.20 + 13.40 + 12.80 + 13.20 + 13.20 + 12.20 + 13.00 + 12.80 + 13.60 ) / 12
AVERAGE : 13.53
PIDSTAT zma : Reporting average of 12 readings at 5 seconds intervals
ZMA Process ID : 27305 ==> ( 5.40 + 1.40 + 0.20 + 0.00 + 1.40 + 2.80 + 4.20 + 1.60 + 2.40 + 0.40 + 0.00 + 3.20 ) / 12
AVERAGE : 1.91
Code: Select all
Tasks: 128 total, 2 running, 82 sleeping, 0 stopped, 0 zombie
%Cpu(s): 3.3 us, 4.2 sy, 0.0 ni, 80.8 id, 11.6 wa, 0.0 hi, 0.1 si, 0.0 st
KiB Mem : 604356 total, 41972 free, 155468 used, 406916 buff/cache
KiB Swap: 102396 total, 52220 free, 50176 used. 345532 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
27301 www-data 20 0 285124 51852 43556 R 13.8 8.6 0:28.61 zmc
27305 www-data 20 0 237468 45552 38584 S 3.0 7.5 0:04.64 zma
27372 pi 20 0 8448 3084 2560 R 1.6 0.5 0:00.20 top
754 mysql 20 0 639116 43456 9096 S 1.3 7.2 2:15.32 mysqld
Code: Select all
https://notabug.org/monitor/ZM_rpi3_HWACCEL_Testing