forked from Github/frigate
Compare commits
12 Commits
v0.5.1-rc3
...
v0.5.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
743116a733 | ||
|
|
8e77cf25d9 | ||
|
|
7d33e03943 | ||
|
|
0c44666c89 | ||
|
|
ddaa746807 | ||
|
|
760e1ffe1d | ||
|
|
15b4024715 | ||
|
|
918112a793 | ||
|
|
4ee200a81c | ||
|
|
e37eba49ff | ||
|
|
6de8e3bd1f | ||
|
|
3a9781c4f8 |
@@ -7,7 +7,7 @@ RUN apt -qq update && apt -qq install --no-install-recommends -y \
|
|||||||
software-properties-common \
|
software-properties-common \
|
||||||
# apt-transport-https ca-certificates \
|
# apt-transport-https ca-certificates \
|
||||||
build-essential \
|
build-essential \
|
||||||
gnupg wget unzip \
|
gnupg wget unzip tzdata \
|
||||||
# libcap-dev \
|
# libcap-dev \
|
||||||
&& add-apt-repository ppa:deadsnakes/ppa -y \
|
&& add-apt-repository ppa:deadsnakes/ppa -y \
|
||||||
&& apt -qq install --no-install-recommends -y \
|
&& apt -qq install --no-install-recommends -y \
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ DEBUG = (CONFIG.get('debug', '0') == '1')
|
|||||||
|
|
||||||
def start_plasma_store():
|
def start_plasma_store():
|
||||||
plasma_cmd = ['plasma_store', '-m', '400000000', '-s', '/tmp/plasma']
|
plasma_cmd = ['plasma_store', '-m', '400000000', '-s', '/tmp/plasma']
|
||||||
plasma_process = sp.Popen(plasma_cmd, stdout=sp.DEVNULL)
|
plasma_process = sp.Popen(plasma_cmd, stdout=sp.DEVNULL, stderr=sp.DEVNULL)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
rc = plasma_process.poll()
|
rc = plasma_process.poll()
|
||||||
if rc is not None:
|
if rc is not None:
|
||||||
@@ -85,6 +85,8 @@ class CameraWatchdog(threading.Thread):
|
|||||||
# wait a bit before checking
|
# wait a bit before checking
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
|
||||||
|
now = datetime.datetime.now().timestamp()
|
||||||
|
|
||||||
# check the plasma process
|
# check the plasma process
|
||||||
rc = self.plasma_process.poll()
|
rc = self.plasma_process.poll()
|
||||||
if rc != None:
|
if rc != None:
|
||||||
@@ -92,8 +94,9 @@ class CameraWatchdog(threading.Thread):
|
|||||||
self.plasma_process = start_plasma_store()
|
self.plasma_process = start_plasma_store()
|
||||||
|
|
||||||
# check the detection process
|
# check the detection process
|
||||||
if (self.tflite_process.detection_start.value > 0.0 and
|
detection_start = self.tflite_process.detection_start.value
|
||||||
datetime.datetime.now().timestamp() - self.tflite_process.detection_start.value > 10):
|
if (detection_start > 0.0 and
|
||||||
|
now - detection_start > 10):
|
||||||
print("Detection appears to be stuck. Restarting detection process")
|
print("Detection appears to be stuck. Restarting detection process")
|
||||||
self.tflite_process.start_or_restart()
|
self.tflite_process.start_or_restart()
|
||||||
elif not self.tflite_process.detect_process.is_alive():
|
elif not self.tflite_process.detect_process.is_alive():
|
||||||
@@ -126,6 +129,17 @@ class CameraWatchdog(threading.Thread):
|
|||||||
camera_capture.start()
|
camera_capture.start()
|
||||||
camera_process['ffmpeg_process'] = ffmpeg_process
|
camera_process['ffmpeg_process'] = ffmpeg_process
|
||||||
camera_process['capture_thread'] = camera_capture
|
camera_process['capture_thread'] = camera_capture
|
||||||
|
elif now - camera_process['capture_thread'].current_frame > 5:
|
||||||
|
print(f"No frames received from {name} in 5 seconds. Exiting ffmpeg...")
|
||||||
|
ffmpeg_process = camera_process['ffmpeg_process']
|
||||||
|
ffmpeg_process.terminate()
|
||||||
|
try:
|
||||||
|
print("Waiting for ffmpeg to exit gracefully...")
|
||||||
|
ffmpeg_process.communicate(timeout=30)
|
||||||
|
except sp.TimeoutExpired:
|
||||||
|
print("FFmpeg didnt exit. Force killing...")
|
||||||
|
ffmpeg_process.kill()
|
||||||
|
ffmpeg_process.communicate()
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# connect to mqtt and setup last will
|
# connect to mqtt and setup last will
|
||||||
@@ -328,7 +342,9 @@ def main():
|
|||||||
if frame is None:
|
if frame is None:
|
||||||
frame = np.zeros((height,int(height*16/9),3), np.uint8)
|
frame = np.zeros((height,int(height*16/9),3), np.uint8)
|
||||||
|
|
||||||
frame = cv2.resize(frame, dsize=(int(height*16/9), height), interpolation=cv2.INTER_LINEAR)
|
width = int(height*frame.shape[1]/frame.shape[0])
|
||||||
|
|
||||||
|
frame = cv2.resize(frame, dsize=(width, height), interpolation=cv2.INTER_LINEAR)
|
||||||
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
|
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
|
||||||
|
|
||||||
ret, jpg = cv2.imencode('.jpg', frame)
|
ret, jpg = cv2.imencode('.jpg', frame)
|
||||||
|
|||||||
Reference in New Issue
Block a user