import requests, numpy as np, cv2 r = requests.get("http://CAMERA-IP:81/stream", stream=True, timeout=5) buf = b"" for chunk in r.iter_content(4096): buf += chunk a = buf.find(b"\xff\xd8"); b = buf.find(b"\xff\xd9") if a != -1 and b != -1 and b > a: img = cv2.imdecode(np.frombuffer(buf[a:b+2], np.uint8), cv2.IMREAD_COLOR) print("frame:", None if img is None else img.shape) break