diff --git a/api attempts/foward image attempts/fo2ward__3.py b/api attempts/foward image attempts/fo2ward__3.py new file mode 100644 index 0000000000000000000000000000000000000000..c1f43c104948dd452fd69d6fc28832d97bb0f02d --- /dev/null +++ b/api attempts/foward image attempts/fo2ward__3.py @@ -0,0 +1,29 @@ +import cv2 +import streamlink + +def get_video_stream_url(): + url = 'http://192.168.0.205/webcam/?action=stream' + streams = streamlink.streams(url) + if 'best' in streams: + return streams['best'].url + else: + return None + +def display_video_stream(): + url = get_video_stream_url() + if url: + cap = cv2.VideoCapture(url) + while cap.isOpened(): + ret, frame = cap.read() + if not ret: + break + cv2.imshow('Video Stream', frame) + if cv2.waitKey(1) & 0xFF == ord('q'): + break + cap.release() + cv2.destroyAllWindows() + else: + print('Unable to retrieve video stream URL') + +if __name__ == '__main__': + display_video_stream()