I'm trying to open an mjpeg stream with VideoCapture in OpenCV2
But whenever I try to read a frame I get the following error thrown:
[mjpeg @ 0x10f4d20] unable to decode APP fields: Invalid data found when processing input
I can watch the stream without issues in the browser. I also tried the typical suggestion of adding a dummy parameter like ?type=.mjpg
but no luck.
This is how I open the stream:
cap = cv2.VideoCapture("http://localhost:8000/camera/mjpeg?type=.mjpg")
while cap.isOpened():
ret, image = cap.read()
if not ret:
break
cv2.imshow("Result", image)