mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-07-26 13:47:03 +02:00
Catch case where segment is bad length (#4228)
* Catch case where segment is bad length * Log ffprobe error code and error
This commit is contained in:
parent
d8123d2497
commit
2a36a1b980
@ -169,9 +169,19 @@ class RecordingMaintainer(threading.Thread):
|
|||||||
p = sp.run(ffprobe_cmd, capture_output=True)
|
p = sp.run(ffprobe_cmd, capture_output=True)
|
||||||
if p.returncode == 0 and p.stdout.decode():
|
if p.returncode == 0 and p.stdout.decode():
|
||||||
duration = float(p.stdout.decode().strip())
|
duration = float(p.stdout.decode().strip())
|
||||||
|
else:
|
||||||
|
duration = -1
|
||||||
|
|
||||||
|
# ensure duration is within expected length
|
||||||
|
if 0 < duration < 600:
|
||||||
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:
|
||||||
|
if duration == -1:
|
||||||
|
logger.warning(
|
||||||
|
f"Failed to probe corrupt segment {f}: {p.returncode} - {p.stderr}"
|
||||||
|
)
|
||||||
|
|
||||||
logger.warning(f"Discarding a corrupt recording segment: {f}")
|
logger.warning(f"Discarding a corrupt recording segment: {f}")
|
||||||
Path(cache_path).unlink(missing_ok=True)
|
Path(cache_path).unlink(missing_ok=True)
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user