PTZ IP-Camera management
Go to file
2023-06-18 13:34:49 +03:00
.vscode streaming.py absorbed cctv-scheduler.py 2023-03-17 20:26:03 +03:00
archive streaming.py absorbed cctv-scheduler.py 2023-03-17 20:26:03 +03:00
info streaming.py absorbed cctv-scheduler.py 2023-03-17 20:26:03 +03:00
.gitignore add configs 2023-02-11 21:23:57 +03:00
cctv-scheduler.conf streaming.py absorbed cctv-scheduler.py 2023-03-17 20:26:03 +03:00
cctv-scheduler.py add Do.tg_routine_media() 2023-06-18 13:34:49 +03:00
converter.conf add Telegram error notification 2023-02-11 22:30:06 +03:00
converter.sh simple code refactoring 2023-03-15 15:17:48 +03:00
LICENSE Initial commit 2023-01-29 09:32:54 +03:00
publisher-template-page-1007.xml add publisher.sh 2023-02-11 20:56:46 +03:00
publisher.conf add configs 2023-02-11 21:23:57 +03:00
publisher.sh simple code refactoring 2023-03-15 15:17:48 +03:00
README.md streaming.py absorbed cctv-scheduler.py 2023-03-17 20:26:03 +03:00

cctv-scheduler

PTZ IP-Camera management



cctv-scheduler

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
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/converter.sh -O /home/user/cctv-scheduler/converter.sh
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/converter.conf -O /home/user/cctv-scheduler/converter.conf
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/publisher.sh -O /home/user/cctv-scheduler/publisher.sh
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/publisher.conf -O /home/user/cctv-scheduler/publisher.conf
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/publisher-template-page-1007.xml -O /home/user/cctv-scheduler/publisher-template-page-1007.xml

Configuration

Edit configs.

nano /home/user/cctv-scheduler/cctv-scheduler.conf
nano /home/user/cctv-scheduler/converter.conf
nano /home/user/cctv-scheduler/publisher.conf

Scheduler

Look at examples and edit scheduler tasks:

crontab -e

cctv-scheduler.py

Description:

Hikvision PTZ IP-Camera management. Media streaming.
Additionally:

  • getting temperature from DS18B20 over SSH,
  • saving pictures to FTP.

This is only a local "proof of conept" for testing and debugging.

Dependencies:

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

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

converter.sh

Description:

JPEG to MP4 converter.

This is only a local "proof of conept" for testing and debugging.

Dependencies:

# filesystem organisation 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
POSITION PARAMETERS DESCRIPTION DEFAULT
1 [qn] execution without pauses
2 [/path/to/conf] path to config ./converter.conf
3 [-d|-w|-m|-y] periods: '' - today | '-d' - yesterday | '-w' - last week | '-m' - last month | '-y' - last year ''

Example usage in terminal with bash for today's MP4 making:

bash ./converter.sh - ./converter.conf

Example usage with cron:

# crontab -e
1  0  *  *  * bash /home/user/cctv-scheduler/converter.sh qn - -d
7  0  *  *  1 bash /home/user/cctv-scheduler/converter.sh qn - -w
30 0  1  *  * bash /home/user/cctv-scheduler/converter.sh qn - -m
36 0  1  1  * bash /home/user/cctv-scheduler/converter.sh qn - -y

publisher.sh

Description:

Uploading MP4 to Wordpress and Telegram.
Additionally:

This is only a local "proof of conept" for testing and debugging.

Dependencies:

POSITION PARAMETERS DESCRIPTION DEFAULT
1 [qn] execution without pauses
2 [/path/to/conf] path to config ./publisher.conf
3 [-d|-w|-m|-y] periods: '' - 0 day | '-d' - -X day | '-w' - -X week | '-m' - -X month | '-y' - -X year ''
4 [1|2|3..XXX] multiplier for period: '' - 1 day|week|month|year 1
5 [--onlytg|--onlywp] '--onlytg' - only publish to Telegram |'--onlywp' - only publish to Wordpress

Example usage in terminal with bash for publish to Telegram today's MP4:

bash ./publisher.sh - ./publisher.conf - - - - --onlytg

Example usage with cron:

# crontab -e
1  1  *  *  * bash /home/user/cctv-scheduler/publisher.sh qn - -d
7  1  *  *  1 bash /home/user/cctv-scheduler/publisher.sh qn - -w
30 1  1  *  * bash /home/user/cctv-scheduler/publisher.sh qn - -m
36 1  1  1  * bash /home/user/cctv-scheduler/publisher.sh qn - -y