allow setting the camera fps if needed

This commit is contained in:
Blake Blackshear 2020-09-13 07:46:38 -05:00
parent 1c33b8acb2
commit 69406343ee
4 changed files with 15 additions and 2 deletions

View File

@ -131,6 +131,14 @@ cameras:
# height: 1280
# width: 720
################
## Specify the framerate of your camera
##
## NOTE: This should only be set in the event ffmpeg is unable to determine your camera's framerate
## on its own and the reported framerate for your camera in frigate is well over what is expected.
################
# fps: 5
################
## Optional mask. Must be the same aspect ratio as your video feed. Value is either the
## name of a file in the config directory or a base64 encoded bmp image prefixed with

View File

@ -203,6 +203,8 @@ def main():
ffmpeg_hwaccel_args = ffmpeg.get('hwaccel_args', FFMPEG_DEFAULT_CONFIG['hwaccel_args'])
ffmpeg_input_args = ffmpeg.get('input_args', FFMPEG_DEFAULT_CONFIG['input_args'])
ffmpeg_output_args = ffmpeg.get('output_args', FFMPEG_DEFAULT_CONFIG['output_args'])
if not config.get('fps') is None:
ffmpeg_output_args = ["-r", str(config.get('fps'))] + ffmpeg_output_args
if config.get('save_clips', {}).get('enabled', False):
ffmpeg_output_args = [
"-f",

View File

@ -35,6 +35,7 @@ class ObjectDetector(ABC):
class LocalObjectDetector(ObjectDetector):
def __init__(self, tf_device=None, labels=None):
self.fps = EventsPerSecond()
if labels is None:
self.labels = {}
else:
@ -83,6 +84,7 @@ class LocalObjectDetector(ObjectDetector):
float(d[1]),
(d[2], d[3], d[4], d[5])
))
self.fps.update()
return detections
def detect_raw(self, tensor_input):

View File

@ -42,12 +42,13 @@ class ProcessClip():
object_detector = LocalObjectDetector(labels='/labelmap.txt')
object_tracker = ObjectTracker(10)
process_fps = EventsPerSecond()
process_fps = mp.Value('d', 0.0)
detection_fps = mp.Value('d', 0.0)
current_frame = mp.Value('d', 0.0)
stop_event = mp.Event()
process_frames(self.camera_name, self.frame_queue, self.frame_shape, self.frame_manager, motion_detector, object_detector, object_tracker, self.detected_objects_queue,
process_fps, current_frame, objects_to_track, object_filters, mask, stop_event, exit_on_empty=True)
process_fps, detection_fps, current_frame, objects_to_track, object_filters, mask, stop_event, exit_on_empty=True)
def objects_found(self, debug_path=None):
obj_detected = False