From ee7eaff96534e0da51462a2c55f2e75ac980b3c3 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Tue, 12 Dec 2023 03:47:40 -0700 Subject: [PATCH] Don't fail if NaN is returned for segment duration (#8923) --- frigate/util/services.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frigate/util/services.py b/frigate/util/services.py index 94946434b..28421cef3 100644 --- a/frigate/util/services.py +++ b/frigate/util/services.py @@ -371,7 +371,7 @@ def vainfo_hwaccel(device_name: Optional[str] = None) -> sp.CompletedProcess: return sp.run(ffprobe_cmd, capture_output=True) -async def get_video_properties(url, get_duration=False): +async def get_video_properties(url, get_duration=False) -> dict[str, any]: async def calculate_duration(video: Optional[any]) -> float: duration = None @@ -405,7 +405,10 @@ async def get_video_properties(url, get_duration=False): result = None if result: - duration = float(result.strip()) + try: + duration = float(result.strip()) + except ValueError: + duration = -1 else: duration = -1