mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Don't fail if NaN is returned for segment duration (#8923)
This commit is contained in:
parent
e512406764
commit
ee7eaff965
@ -371,7 +371,7 @@ def vainfo_hwaccel(device_name: Optional[str] = None) -> sp.CompletedProcess:
|
|||||||
return sp.run(ffprobe_cmd, capture_output=True)
|
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:
|
async def calculate_duration(video: Optional[any]) -> float:
|
||||||
duration = None
|
duration = None
|
||||||
|
|
||||||
@ -405,7 +405,10 @@ async def get_video_properties(url, get_duration=False):
|
|||||||
result = None
|
result = None
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
|
try:
|
||||||
duration = float(result.strip())
|
duration = float(result.strip())
|
||||||
|
except ValueError:
|
||||||
|
duration = -1
|
||||||
else:
|
else:
|
||||||
duration = -1
|
duration = -1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user