mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 18:55:23 +03:00
Don't save segments < 3 seconds in duration
This commit is contained in:
parent
761daf46ea
commit
042f2e8b34
@ -16,6 +16,7 @@ from frigate.const import (
|
|||||||
AUDIO_MIN_CONFIDENCE,
|
AUDIO_MIN_CONFIDENCE,
|
||||||
CACHE_DIR,
|
CACHE_DIR,
|
||||||
DEFAULT_DB_PATH,
|
DEFAULT_DB_PATH,
|
||||||
|
MIN_SEGMENT_DURATION,
|
||||||
REGEX_CAMERA_NAME,
|
REGEX_CAMERA_NAME,
|
||||||
YAML_EXT,
|
YAML_EXT,
|
||||||
)
|
)
|
||||||
@ -931,9 +932,10 @@ def verify_recording_segments_setup_with_reasonable_time(
|
|||||||
f"Camera {camera_config.name} has no segment_time in recording output args, segment args are required for record."
|
f"Camera {camera_config.name} has no segment_time in recording output args, segment args are required for record."
|
||||||
)
|
)
|
||||||
|
|
||||||
if int(record_args[seg_arg_index + 1]) > 60:
|
config_duration = int(record_args[seg_arg_index + 1])
|
||||||
|
if config_duration < MIN_SEGMENT_DURATION or config_duration > 60:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Camera {camera_config.name} has invalid segment_time output arg, segment_time must be 60 or less."
|
f"Camera {camera_config.name} has invalid segment_time output arg, segment_time must be {MIN_SEGMENT_DURATION} <= x <= 60."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -45,6 +45,7 @@ DRIVER_INTEL_iHD = "iHD"
|
|||||||
|
|
||||||
# Record Values
|
# Record Values
|
||||||
|
|
||||||
|
MIN_SEGMENT_DURATION = 3
|
||||||
MAX_SEGMENT_DURATION = 600
|
MAX_SEGMENT_DURATION = 600
|
||||||
MAX_PLAYLIST_SECONDS = 7200 # support 2 hour segments for a single playlist to account for cameras with inconsistent segment times
|
MAX_PLAYLIST_SECONDS = 7200 # support 2 hour segments for a single playlist to account for cameras with inconsistent segment times
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,7 @@ from frigate.const import (
|
|||||||
CACHE_DIR,
|
CACHE_DIR,
|
||||||
INSERT_MANY_RECORDINGS,
|
INSERT_MANY_RECORDINGS,
|
||||||
MAX_SEGMENT_DURATION,
|
MAX_SEGMENT_DURATION,
|
||||||
|
MIN_SEGMENT_DURATION,
|
||||||
RECORD_DIR,
|
RECORD_DIR,
|
||||||
)
|
)
|
||||||
from frigate.models import Event, Recordings
|
from frigate.models import Event, Recordings
|
||||||
@ -199,7 +200,7 @@ class RecordingMaintainer(threading.Thread):
|
|||||||
duration = -1
|
duration = -1
|
||||||
|
|
||||||
# ensure duration is within expected length
|
# ensure duration is within expected length
|
||||||
if 0 < duration < MAX_SEGMENT_DURATION:
|
if MIN_SEGMENT_DURATION < duration < MAX_SEGMENT_DURATION:
|
||||||
end_time = start_time + datetime.timedelta(seconds=duration)
|
end_time = start_time + datetime.timedelta(seconds=duration)
|
||||||
self.end_time_cache[cache_path] = (end_time, duration)
|
self.end_time_cache[cache_path] = (end_time, duration)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user