Skip to content

NVR with realtime local object detection for IP cameras

Catch case where recording starts right at end of request (#12956)

Nicolas Mowen13d121f4436d
diff --git a/frigate/api/media.py b/frigate/api/media.py
index 98bb2f9520..911e13f7e1 100644
--- a/frigate/api/media.py
+++ b/frigate/api/media.py
@@ -546,6 +546,11 @@ def vod_ts(camera_name, start_ts, end_ts):
if recording.end_time > end_ts:
duration -= int((recording.end_time - end_ts) * 1000)
+ if duration == 0:
+ # this means the segment starts right at the end of the requested time range
+ # and it does not need to be included
+ continue
+
if 0 < duration < max_duration_ms:
clip["keyFrameDurations"] = [duration]
clips.append(clip)