mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-11 13:45:25 +03:00
Handle out of resources
This commit is contained in:
parent
556b3f70d1
commit
201ac310a4
@ -5,6 +5,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import subprocess as sp
|
import subprocess as sp
|
||||||
import threading
|
import threading
|
||||||
|
import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
@ -101,12 +102,24 @@ class FFMpegConverter(threading.Thread):
|
|||||||
f"duration {self.frame_times[t_idx + 1] - self.frame_times[t_idx]}"
|
f"duration {self.frame_times[t_idx + 1] - self.frame_times[t_idx]}"
|
||||||
)
|
)
|
||||||
|
|
||||||
p = sp.run(
|
try:
|
||||||
self.ffmpeg_cmd.split(" "),
|
p = sp.run(
|
||||||
input="\n".join(playlist),
|
self.ffmpeg_cmd.split(" "),
|
||||||
encoding="ascii",
|
input="\n".join(playlist),
|
||||||
capture_output=True,
|
encoding="ascii",
|
||||||
)
|
capture_output=True,
|
||||||
|
)
|
||||||
|
except BlockingIOError:
|
||||||
|
logger.warning(
|
||||||
|
f"Failed to create preview for {self.config.name}, retrying..."
|
||||||
|
)
|
||||||
|
time.sleep(2)
|
||||||
|
p = sp.run(
|
||||||
|
self.ffmpeg_cmd.split(" "),
|
||||||
|
input="\n".join(playlist),
|
||||||
|
encoding="ascii",
|
||||||
|
capture_output=True,
|
||||||
|
)
|
||||||
|
|
||||||
start = self.frame_times[0]
|
start = self.frame_times[0]
|
||||||
end = self.frame_times[-1]
|
end = self.frame_times[-1]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user