mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-07 22:05:44 +03:00
Set minimum duration for recording based review items
This commit is contained in:
parent
e5a2e9637b
commit
d8dff40987
@ -30,6 +30,7 @@ from ..types import DataProcessorMetrics
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
RECORDING_BUFFER_EXTENSION_PERCENT = 0.10
|
RECORDING_BUFFER_EXTENSION_PERCENT = 0.10
|
||||||
|
MIN_RECORDING_DURATION = 10
|
||||||
|
|
||||||
|
|
||||||
class ReviewDescriptionProcessor(PostProcessorApi):
|
class ReviewDescriptionProcessor(PostProcessorApi):
|
||||||
@ -134,6 +135,14 @@ class ReviewDescriptionProcessor(PostProcessorApi):
|
|||||||
10, max(2, duration * RECORDING_BUFFER_EXTENSION_PERCENT)
|
10, max(2, duration * RECORDING_BUFFER_EXTENSION_PERCENT)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Ensure minimum total duration for short review items
|
||||||
|
# This provides better context for brief events
|
||||||
|
total_duration = duration + (2 * buffer_extension)
|
||||||
|
if total_duration < MIN_RECORDING_DURATION:
|
||||||
|
# Expand buffer to reach minimum duration, still respecting max of 10s per side
|
||||||
|
additional_buffer_per_side = (MIN_RECORDING_DURATION - duration) / 2
|
||||||
|
buffer_extension = min(10, additional_buffer_per_side)
|
||||||
|
|
||||||
thumbs = self.get_recording_frames(
|
thumbs = self.get_recording_frames(
|
||||||
camera,
|
camera,
|
||||||
final_data["start_time"] - buffer_extension,
|
final_data["start_time"] - buffer_extension,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user