Created
October 26, 2020 00:07
-
-
Save badjano/27c870b45ffd936fa8088b7b43a0e81d to your computer and use it in GitHub Desktop.
Foscam Open CV Stream
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from threading import Thread | |
import cv2 | |
def connect(user, pwd, ip="192.168.0.1", port=88): | |
cap = cv2.VideoCapture('rtsp://%s:%s@%s:%d/videoMain' % (user, pwd, ip, port)) | |
while True: | |
ret, frame = cap.read() | |
cv2.imshow("Cam: %s" % ip, frame) | |
if cv2.waitKey(1) & 0xFF == ord('q'): | |
break | |
cap.release() | |
cv2.destroyAllWindows() | |
def all(): | |
threads = [] | |
user = "user" | |
pwd = "pwd" | |
port = 88 | |
for ip in ["192.168.0.1", "192.168.0.2"]: | |
thread = Thread(target=connect, args=(user, pwd, ip, port,)) | |
threads.append(thread) | |
thread.start() | |
for thread in threads: | |
thread.join() | |
all() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment