@@ -56,6 +56,8 @@ <h3><a name="Examples"></a> Examples</h3>
5656 < li > < a href ="#dnn_setup "> DNN setup</ a > </ li >
5757 < li > < a href ="#haar_train "> Haar Model Training</ a > </ li >
5858 < li > < a href ="#sound_sample "> Sound Frequency Sample</ a > </ li >
59+ < li > < a href ="#fail2ban "> Fail2Ban example</ a > </ li >
60+ < li > < a href ="#ptz "> PTZ command examples</ a > </ li >
5961 < p > </ p >
6062 < p > </ p >
6163 </ ul >
@@ -91,19 +93,19 @@ <h3><a name="extpipe_commands"></a>Sample extpipe commands</h3>
9193 The following are some sample extpipe commands
9294 < p > </ p >
9395 < code >
94- movie_extpipe mencoder -demuxer rawvideo -rawvideo w=%w:h=%h:i420 -ovc x264 -x264encopts bframes=4:frameref=1:subq=1:scenecut=-1:nob_adapt:threads=1:keyint=1000:8x8dct:vbv_bufsize=4000:crf=24:partitions=i8x8,i4x4:vbv_maxrate=800:no-chroma-me -vf denoise3d=16:12:48:4,pp=lb -of avi -o %f.avi - -fps %fps
96+ movie_extpipe mencoder -demuxer rawvideo -rawvideo w=%w:h=%h:i420 -ovc x264 -x264encopts bframes=4:frameref=1:subq=1:scenecut=-1:nob_adapt:threads=1:keyint=1000:8x8dct:vbv_bufsize=4000:crf=24:partitions=i8x8,i4x4:vbv_maxrate=800:no-chroma-me -vf denoise3d=16:12:48:4,pp=lb -of avi -o %f.avi - -fps %{ fps}
9597 </ code >
9698 < p > </ p >
9799 < code >
98- movie_extpipe x264 - --input-res %wx%h --fps %fps --bitrate 2000 --preset ultrafast --quiet -o %f.mp4
100+ movie_extpipe x264 - --input-res %wx%h --fps %{ fps} --bitrate 2000 --preset ultrafast --quiet -o %f.mp4
99101 </ code >
100102 < p > </ p >
101103 < code >
102- movie_extpipe mencoder -demuxer rawvideo -rawvideo w=%w:h=%h:fps=%fps -ovc x264 -x264encopts preset=ultrafast -of lavf -o %f.mp4 - -fps %fps
104+ movie_extpipe mencoder -demuxer rawvideo -rawvideo w=%w:h=%h:fps=%{ fps} -ovc x264 -x264encopts preset=ultrafast -of lavf -o %f.mp4 - -fps %{ fps}
103105 </ code >
104106 < p > </ p >
105107 < code >
106- movie_extpipe ffmpeg -y -f rawvideo -pix_fmt yuv420p -video_size %wx%h -framerate %fps -i pipe:0 -vcodec libx264 -preset ultrafast -f mp4 %f.mp4
108+ movie_extpipe ffmpeg -y -f rawvideo -pix_fmt yuv420p -video_size %wx%h -framerate %{ fps} -i pipe:0 -vcodec libx264 -preset ultrafast -f mp4 %f.mp4
107109 </ code >
108110 < p > </ p >
109111 </ ul >
@@ -172,7 +174,7 @@ <h3><a name="database_setup"></a>Database Setup</h3>
172174 invited to provide suggestions and corrections to these steps.
173175 < small > < small > < code >
174176 < ul >
175- sudo apt install libmariadb-dev libmariadb3 mariadb-client-10.5 mariadb-client-core-10.5 mariadb-common mariadb-server
177+ sudo apt install libmariadb-dev libmariadb3 mariadb-client mariadb-client-core mariadb-common mariadb-server
176178 < br > sudo mariadb
177179 < ul >
178180 GRANT ALL ON *.* TO 'YourUserNameHere'@'localhost' IDENTIFIED BY 'YourPasswordHere' WITH GRANT OPTION;
@@ -237,6 +239,14 @@ <h3><a name="webcontrol_pages"></a>Webcontrol pages</h3>
237239 < li > < code > {IP}:{port0}/{camid}/mjpg/motion</ code > Stream of motion images for the camera as a mjpg</ li >
238240 < li > < code > {IP}:{port0}/{camid}/mjpg/source</ code > Source image stream of the camera as a mjpg</ li >
239241 </ ul >
242+ The following mpegts pages are available via the webcontrol. (Update automatically)
243+ < ul >
244+ < li > < code > {IP}:{port0}/{camid}/mpegts</ code > Primary stream for the camera updated as a mpeg transport stream</ li >
245+ < li > < code > {IP}:{port0}/{camid}/mpegts/substream</ code > Substream for the camera updated as a mpeg transport stream</ li >
246+ < li > < code > {IP}:{port0}/{camid}/mpegts/motion</ code > Stream of motion images for the camera as a mpeg transport stream</ li >
247+ < li > < code > {IP}:{port0}/{camid}/mpegts/source</ code > Source image stream of the camera as a mpeg transport stream</ li >
248+ </ ul >
249+
240250 The following static pages are available via the webcontrol. (Update manually)
241251 < ul >
242252 < li > < code > {IP}:{port0}/{camid}/static</ code > Primary image for the camera</ li >
@@ -442,6 +452,147 @@ <h3><a name="sound_sample"></a>Sound Frequency Sample</h3>
442452
443453 </ ul >
444454
455+ < h3 > < a name ="fail2ban "> </ a > Fail2Ban Example</ h3 >
456+ < ul >
457+ The following are example files to use with the fail2ban application. This allows users to ban IPs that
458+ may be attempting to get in. This example was created using Debian 11. Adjust as appropriate for other
459+ distros and versions.
460+ < br >
461+ Install fail2ban and create the following files:
462+ < br > File 1:
463+ < small > < small > < code > < ul >
464+ < br > # Fail2Ban configuration file: /etc/fail2ban/filter.d/motionplus.conf
465+ < br > # Author: Mr Dave
466+ < br > #
467+ < br > [INCLUDES]
468+ < br > # Read common prefixes. If any customizations available -- read them from common.local
469+ < br > before = common.conf
470+ < br >
471+ < br > [Definition]
472+ < br > daemon = nsd
473+ < br >
474+ < br > # Option: failregex
475+ < br > # Notes.:
476+ < br > # regex to match the log in failures messages in the logfile. The
477+ < br > # host must be matched by a group named "host". The tag "<HOST>" can
478+ < br > # be used for standard IP/hostname matching and is only an alias for
479+ < br > # (?:::f{4,6}:)?(?P< host > [\w\-.^_]+)
480+ < br > # Sample: Jul 01 02:50:32 [EMG][STR][00:wc00] webu_failauth_check: Ignoring connection from: 192.168.1.10
481+ < br > # Values: TEXT
482+ < br >
483+ < br > failregex = ^.*Ignoring connection from: <HOST>$
484+ < br >
485+ < br > ignoreregex =
486+ < br >
487+ < br > datepattern = {^LN-BEG}Epoch
488+ < br > {^LN-BEG}
489+ < br >
490+ </ ul > </ code > </ small > </ small >
491+ < br > File2:
492+ < small > < small > < code > < ul >
493+ < br > #Fail2Ban Jail Configuration File: /etc/fail2ban/jail.d/motionplus-jail.conf
494+ < br > [motionplus]
495+ < br > enabled = true
496+ < br > filter = motionplus
497+ < br > logpath = /var/log/motionplus/motionplus.log
498+ < br > bantime = 23h
499+ < br > banaction = iptables-allports[blocktype="DROP"]
500+ < br > maxretry = 0
501+ < br > port = 0:65535
502+ </ ul > </ code > </ small > </ small >
503+ < br > Make sure to adjust the log file location indicated in the jail file as well as how long to ban the IP address.
504+ </ ul >
505+
506+ < h3 > < a name ="ptz "> </ a > PTZ command examples</ h3 >
507+ < ul >
508+ The following are some example sources and scripts to send PTZ (Pan Tilt Zoom) commands to cameras.
509+ < br > < br >
510+ < a href ="https://github.com/667bdrm/sofiactl "> sofiactl</ a > is a Perl script that can control many imported inexpensive cameras.
511+ < br > Adjust script location, timing, cameraip, user, etc as appropriate.
512+ < small > < small > < code > < ul >
513+ < br > #!/bin/bash
514+ < br > sofiactl.pl --user admin --host cameraip --port 34567 --command OPPTZControl --sd ZoomTile --s2 0.5
515+ < br > sofiactl.pl --user admin --host cameraip --port 34567 --command OPPTZControl --sd ZoomWide --s2 0.5
516+ < br > sofiactl.pl --user admin --host cameraip --port 34567 --command OPPTZControl --sd DirectionUp --s2 2.0
517+ < br > sofiactl.pl --user admin --host cameraip --port 34567 --command OPPTZControl --sd DirectionDown --s2 2.0
518+ < br > sofiactl.pl --user admin --host cameraip --port 34567 --command OPPTZControl --sd DirectionLeft --s2 2.0
519+ < br > sofiactl.pl --user admin --host cameraip --port 34567 --command OPPTZControl --sd DirectionRight --s2 2.0
520+ < br > exit
521+ </ ul > </ code > </ small > </ small >
522+
523+ < br >
524+ < a href ="https://github.com/Mr-Dave/camxmctl "> camxmctl</ a > is a c++ program with a sample HTML page that makes adjusting the parameters
525+ easier. It reuses some of the code from Motionplus and is based upon the JSON files and commands in the
526+ < a href ="https://github.com/667bdrm/sofiactl "> sofiactl</ a > script.
527+ < br > Adjust location, timing, cameraip, user, etc as appropriate.
528+ < small > < small > < code > < ul >
529+ < br > #!/bin/bash
530+ < br > tbd. Review sample page to see post commands.
531+ < br > exit
532+ </ ul > </ code > </ small > </ small >
533+
534+ < br >
535+ curl scripts. Example 1
536+ < br > Adjust as appropriate.
537+ < small > < small > < code > < ul >
538+ < br > #!/bin/bash
539+ < br > curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -d 'Param1=1' http://admin@cameraip:80/PTZ/1/TurnDown
540+ < br > sleep 2
541+ < br > curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -d 'Param1=0' http://admin@cameraip:80/PTZ/1/TurnDown
542+ < br > exit
543+ < br > #!/bin/bash
544+ < br > curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -d 'Param1=1' http://admin@cameraip:80/PTZ/1/TurnLeft
545+ < br > sleep 2
546+ < br > curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -d 'Param1=0' http://admin@cameraip:80/PTZ/1/TurnLeft
547+ < br > exit
548+ < br > #!/bin/bash
549+ < br > curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -d 'Param1=1' http://admin@cameraip:80/PTZ/1/TurnRight
550+ < br > sleep 2
551+ < br > curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -d 'Param1=0' http://admin@cameraip:80/PTZ/1/TurnRight
552+ < br > exit
553+ < br > #!/bin/bash
554+ < br > curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -d 'Param1=1' http://admin@cameraip:80/PTZ/1/TurnUp
555+ < br > sleep 2
556+ < br > curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -d 'Param1=0' http://admin@cameraip:80/PTZ/1/TurnUp
557+ < br > exit
558+ </ ul > </ code > </ small > </ small >
559+
560+ < br >
561+ curl scripts. Example 2
562+ < br > Adjust as appropriate.
563+ < small > < small > < code > < ul >
564+ < br > #!/bin/bash
565+ < br > curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=left&-speed=45'
566+ < br > sleep 1
567+ < br > curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=stop&-speed=45'
568+ < br > exit
569+ < br > #!/bin/bash
570+ < br > curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=right&-speed=45'
571+ < br > sleep 1
572+ < br > curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=stop&-speed=45'
573+ < br > exit
574+ < br > #!/bin/bash
575+ < br > curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=down&-speed=45'
576+ < br > sleep 1
577+ < br > curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=stop&-speed=45'
578+ < br > exit
579+ < br > #!/bin/bash
580+ < br > curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=up&-speed=45'
581+ < br > sleep 1
582+ < br > curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=stop&-speed=45'
583+ < br > exit
584+ < br > #!/bin/bash
585+ < br > curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=zoomin&-speed=45'
586+ < br > sleep 1
587+ < br > curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=stop&-speed=45'
588+ < br > exit
589+ < br > #!/bin/bash
590+ < br > curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=zoomout&-speed=45'
591+ < br > sleep 1
592+ < br > curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=stop&-speed=45'
593+ < br > exit
594+ </ ul > </ code > </ small > </ small >
595+ </ ul >
445596
446597 </ section >
447598 </ body >
0 commit comments