Hi,
I have an external USB webcam (“EVOCAM II” from VisionEng. Video output is directshow) for a livestream with overlays that changes when hitting a keybutton.
Problem:
My livestream goes black after a few minutes (without performing any action). Once it is black it stays black without an error message.
I first thought it had something to do with inactivity but sometimes it goes black after 2 minutes or even after 15 minutes. I even replaced the camera and USB cable and the problem still occurs
Anyone have any idea what the problem is or how I can get the picture back without stopping the livestream? Is there something like a query (if black then do…)
# Start Button Action
def pushbutton_left_Callback(self):
# Initialization
...
self.cap = cv2.VideoCapture(1,cv2.CAP_DSHOW)
...
def cap_img(self, cap): ret, img = cap.read() if not ret: print("No Frame. Livestream close") return None img = cv2.flip(img,1)#flip cam img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) height, width, channel = img.shape step = channel * width img = QImage(img.data, width, height, step, QImage.Format_RGB888) if height != HEIGHT and width != WIDTH: img = img.scaled(WIDTH, HEIGHT) return img
def snap_img(self, cap): ret, img = cap.read() if not ret: print("No Frame. Livestream close") return None img = cv2.flip(img,1)#flip cam self.snap_cv = img.copy() img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) height, width, channel = img.shape step = channel * width self.snap = QImage(img.data, width, height, step, QImage.Format_RGB888) if height != HEIGHT and width != WIDTH: self.snap = self.snap.scaled(WIDTH, HEIGHT)