forked from Github/frigate
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64b63142b1 | ||
|
|
cee1ab000b | ||
|
|
3ff98770c1 | ||
|
|
244203463d |
@@ -477,14 +477,14 @@ mask: 'poly,0,461,3,0,1919,0,1919,843,1699,492,1344,458,1346,336,973,317,869,375
|
||||
|
||||
<a href="docs/example-mask-poly.png"><img src="docs/example-mask-poly.png" height="300"></a>
|
||||
|
||||
You can test your mask by temporarily configuring it as a [zone](#zones) and enabling`draw_zones` in your config.
|
||||
You can test your mask by temporarily configuring it as a [zone](#zones) and enabling `draw_zones` in your config. Zones are visible on the [MJPEG feed](#camera_name).
|
||||
|
||||
[Back to top](#documentation)
|
||||
|
||||
## Zones
|
||||
Zones allow you to define a specific area of the frame and apply additional filters for object types so you can determine whether or not an object is within a particular area. Zones cannot have the same name as a camera. If desired, a single zone can include multiple cameras if you have multiple cameras covering the same area by configuring zones with the same name for each camera.
|
||||
|
||||
During testing, `draw_zones` should be set in the config to draw the zone on the frames so you can adjust as needed. The zone line will increase in thickness when any object enters the zone.
|
||||
During testing, `draw_zones` should be set in the config to draw the zone on the frames so you can adjust as needed. The zone line will increase in thickness when any object enters the zone. Zones are visible on the [MJPEG feed](#camera_name).
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -244,6 +244,7 @@ def main():
|
||||
'detection_fps': mp.Value('d', 0.0),
|
||||
'detection_frame': mp.Value('d', 0.0),
|
||||
'read_start': mp.Value('d', 0.0),
|
||||
'ffmpeg_pid': mp.Value('i', 0),
|
||||
'frame_queue': mp.Queue(maxsize=2)
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class EventProcessor(threading.Thread):
|
||||
files_in_use = []
|
||||
for process_data in self.camera_processes.values():
|
||||
try:
|
||||
ffmpeg_process = psutil.Process(pid=process_data['ffmpeg_process'].pid)
|
||||
ffmpeg_process = psutil.Process(pid=process_data['ffmpeg_pid'].value)
|
||||
flist = ffmpeg_process.open_files()
|
||||
if flist:
|
||||
for nt in flist:
|
||||
|
||||
@@ -122,6 +122,7 @@ def capture_frames(ffmpeg_process, camera_name, frame_shape, frame_manager: Fram
|
||||
frame_num = 0
|
||||
frame_size = frame_shape[0] * frame_shape[1] * 3 // 2
|
||||
frame_rate = EventsPerSecond()
|
||||
frame_rate.start()
|
||||
skipped_eps = EventsPerSecond()
|
||||
skipped_eps.start()
|
||||
while True:
|
||||
@@ -167,7 +168,7 @@ def capture_frames(ffmpeg_process, camera_name, frame_shape, frame_manager: Fram
|
||||
frame_queue.put(current_frame.value)
|
||||
|
||||
class CameraWatchdog(threading.Thread):
|
||||
def __init__(self, name, config, frame_queue, camera_fps, stop_event):
|
||||
def __init__(self, name, config, frame_queue, camera_fps, ffmpeg_pid, stop_event):
|
||||
threading.Thread.__init__(self)
|
||||
self.name = name
|
||||
self.config = config
|
||||
@@ -175,6 +176,7 @@ class CameraWatchdog(threading.Thread):
|
||||
self.ffmpeg_process = None
|
||||
self.stop_event = stop_event
|
||||
self.camera_fps = camera_fps
|
||||
self.ffmpeg_pid = ffmpeg_pid
|
||||
self.frame_queue = frame_queue
|
||||
self.frame_shape = self.config['frame_shape']
|
||||
self.frame_size = self.frame_shape[0] * self.frame_shape[1] * 3 // 2
|
||||
@@ -207,6 +209,7 @@ class CameraWatchdog(threading.Thread):
|
||||
|
||||
def start_ffmpeg(self):
|
||||
self.ffmpeg_process = start_or_restart_ffmpeg(self.config['ffmpeg_cmd'], self.frame_size)
|
||||
self.ffmpeg_pid.value = self.ffmpeg_process.pid
|
||||
self.capture_thread = CameraCapture(self.name, self.ffmpeg_process, self.frame_shape, self.frame_queue,
|
||||
self.config['take_frame'], self.camera_fps, self.stop_event)
|
||||
self.capture_thread.start()
|
||||
@@ -234,7 +237,7 @@ class CameraCapture(threading.Thread):
|
||||
|
||||
def capture_camera(name, config, process_info, stop_event):
|
||||
frame_queue = process_info['frame_queue']
|
||||
camera_watchdog = CameraWatchdog(name, config, frame_queue, process_info['camera_fps'], stop_event)
|
||||
camera_watchdog = CameraWatchdog(name, config, frame_queue, process_info['camera_fps'], process_info['ffmpeg_pid'], stop_event)
|
||||
camera_watchdog.start()
|
||||
camera_watchdog.join()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user