a065b7a1d3
Completely reformed the internal workings of the application code. I brought back multi-threaded functions so there is now 5 separate threads for different tasks. recLoop() - this function calls ffmpeg to begin recording footage from the defined camera and stores the footage in hls format. It is designed to keep running for as long as the application is running and if it does stop for whatever reason, it will attempt to auto re-start. upkeep() - this function does regular cleanup and enforcement of maxDays maxLogSize and maxEvents without the need to stop recording or detecting motion. detectMo() - this function reads directly from recLoop's hls output and list all footage that has motion in it. motion detection no longer has to wait for the clip to finish recording thanks to the use of .ts containers for the video clips. this makes the motion detection for less cpu intensive now that it will now operate at the camera's fps (slower). eventLoop() - this function reads the motion list from detectMo and copies the footage pointed out by the list to an events folder, also in hls format. schLoop() - this function runs an optional user defined external command every amount of seconds defined in sch_sec. this command temporary stops motion detection without actually terminating the thread. It will also not run the command at the scheduled time if motion was detected. Benefits to this reform: - far less cpu intensive operation - multi-threaded architecture for better asynchronous operation - it has support for live streaming now that hls is being used - a buff_dir is no longer necessary
30 lines
730 B
Bash
30 lines
730 B
Bash
#!/bin/sh
|
|
apt update -y
|
|
apt install -y pkg-config
|
|
apt install -y cmake
|
|
apt install -y make
|
|
apt install -y g++
|
|
apt install -y wget
|
|
apt install -y unzip
|
|
apt install -y git
|
|
apt install -y ffmpeg
|
|
apt install -y gstreamer1.0*
|
|
apt install -y libavcodec-dev
|
|
apt install -y libavformat-dev
|
|
apt install -y libavutil-dev
|
|
apt install -y libswscale-dev
|
|
apt install -y libgstreamer1.0-dev
|
|
apt install -y x264
|
|
apt install -y libx264-dev
|
|
apt install -y libilmbase-dev
|
|
apt install -y libopencv-dev
|
|
apt install -y apache2
|
|
add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
|
apt update -y
|
|
apt install -y gcc-10
|
|
apt install -y gcc-10-base
|
|
apt install -y gcc-10-doc
|
|
apt install -y g++-10
|
|
apt install -y libstdc++-10-dev
|
|
apt install -y libstdc++-10-doc
|