A simple python script, with motion detection and recording support for HDIPCAM MEYE-035366-CCFBB camera.
For default use you'll need to create log
, storage
and temp
folders in the directory to which
you clone this repository. This paths can be changed, see parameters bellow.
Python version 3 is required, also make sure you have Pillow
package...
# pip install pillow
...and ffmpeg
, which you can get on their official website.
To start program in watchdog mode, run: ./hdipcam.py -i <CAM IP AND PORT>
Common usage example:
./hdipcam.py -i 192.168.1.178:9081 -v --user=uname --password=secret --motionat 10 --mask 80.410.230.150,120.0.100.150
Show help message and exit
-h, --help
Camera's IP and port, for example: 192.168.1.1:8020 This parameter is required.
-i IP, --ip IP
Print detailed information.
-v, --verbose
Default: 8
How many seconds before termination of recording, when no motion detected. Each strike count as a second. If the value is 5, that mean there will be 5 seconds pause, before recording will be terminated. If in those 5 seconds motion is detected, the timer is reseted.
-s STRIKES, --strikes STRIKES
Default: 7
Level of difference to be considered motion. You can experiment with values in --test
mode. Usually a good value is between 5 and 15.
-m MOTIONAT, --motionat MOTIONAT
Default: 2
Frames per second. Not recommended more than 2.
-f FPS, --fps FPS
Default: 1
Pause between two images (when comparing) in seconds. This will capture image A, wait Ns, capture image B, and then compare them. One to two seconds is usually a good value.
-p PAUSE, --pause PAUSE
Mask to be applied on images when comparing them.
Format: top.left.width.height,top.left...
Example: 20.20.200.200,400.400.60.120
This used to ignore motion, if for example your camera is partly capturing a road or a tree which would be swaying in the wind.
-b MASK, --mask MASK
Default: ./temp
Temporary folder, where images will be stored for recording and tests. WARNING: content will be deleted. Start with dot for relative.
./hdipcam.py --temp ./relative_temp
./hdipcam.py --temp /var/tmp/hdipcam
--temp TEMP
Default: ./storage
Storage folder for videos.Start with dot for relative.
--storage STORAGE
Log file path. If this parameter is absent, logs won't be saved. Start with dot for relative.
--log LOG
Default: /snapshot.cgi?user=%s&pwd=%s
Device image URI, with username and password placeholders.
--uri URI
Default: None
Login username, if required.
--user USER
Login password if required.
--password PASSWORD
Run in test mode, save N of images to storage folder for comparison.
--test TEST
Start recording for N seconds.
--record RECORD
The hdipcam application is licensed under the GPL-3.0 or later.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.