generated from pavel.muhortov/template-bash
4.4 KiB
4.4 KiB
cctv-scheduler
PTZ IP-Camera management
Installation
Requirements
Cameras settings:
- Configuration -> System -> Security -> Authentication -> RTSP Authentication: digest/basic
- Configuration -> System -> Security -> Authentication -> WEB Authentication: digest/basic
- Configuration -> Network -> Advanced Settings -> Integration Protocol -> Enable Hikvision-CGI: Enabled
- Configuration -> Network -> Advanced Settings -> Integration Protocol -> Hikvision-CGI Authentication: digest/basic
Look at the description of dependencies and install the necessary.
Downloading
Download scripts and configs.
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/cctv-scheduler.py -O /home/user/cctv-scheduler/cctv-scheduler.py
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/cctv-scheduler.conf -O /home/user/cctv-scheduler/cctv-scheduler.conf
Configuration
Edit configs.
nano /home/user/cctv-scheduler/cctv-scheduler.conf
Scheduler
Look at examples and edit scheduler tasks:
crontab -e
cctv-scheduler
.py
Description:
Hikvision PTZ IP-Camera management. Media streaming. Images to video converting.
Additionally:
- getting temperature from DS18B20 over SSH,
- saving pictures to FTP, SFTP, SMB.
- converting picture collection to video.
- publishing video to Telegram chat and Wordpress site.
This is only a local "proof of concept" for testing and debugging.
Dependencies:
- Python 3 (tested version 3.9.5 on Debian GNU/Linux 11)
- paramiko Python 3 module (tested version 3.1.0)
- smbprotocol Python 3 module (tested version 1.10.1)
- ffmpeg (tested version 4.3.4 on Debian GNU/Linux 11)
- specified record pictures filesystem organization
# record pictures filesystem organization example /root/ /2022/ /12/ /52/ /31/ /image-01_2022.12.31_time.jpeg /image-02_2022.12.31_time.jpeg /2023/ /01/ /01/ /02/ /image-01_2023.01.02_time.jpeg /image-02_2023.01.02_time.jpeg /03/ /image-01_2023.01.03_time.jpeg /image-02_2023.01.03_time.jpeg
PARAMETERS | DESCRIPTION | DEFAULT |
---|---|---|
[-h] | print help and exit | |
[-b, --broadcast] | streaming media to destination | None |
[-s, --sequences] | run sequences from config file | None |
[--config] | custom configuration file path | ./cctv-scheduler.conf |
[-c, --converter] | convert JPEG collection to MP4 | None |
[-p, --publisher] | publish content from templates | None |
[-d, --day] | day in amount of days from today, for which the publication or conversion is made | 0 |
[-w, --week] | week in amount of weeks from today, for which the publication or conversion is made | 0 |
[-m, --month] | month in amount of months from today, for which the publication or conversion is made | 0 |
[-y, --year] | year in amount of years from today, for which the publication or conversion is made | 0 |
Example usage in terminal with make the script executable:
chmod u+x ./cctv-scheduler.py
./cctv-scheduler.py -s --config /home/user/cctv-scheduler/cctv-scheduler.conf
Example usage with cron:
# crontab -e
* * * * * /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -b
0 * * * * /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -s
1 0 * * * /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -d -1 -c -p
7 0 * * 1 /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -w -1 -c -p
30 0 1 * * /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -m -1 -c -p
36 0 1 1 * /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -y -1 -c -p