From f519557c7c178c9f555a7b3bd25d94c380def44c Mon Sep 17 00:00:00 2001 From: s47700 <s47700@bht-berlin.de> Date: Sat, 23 Mar 2024 16:25:42 +0100 Subject: [PATCH] Upload New File --- .../foward image attempts/fo2ward__3.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 api attempts/foward image attempts/fo2ward__3.py 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 0000000..c1f43c1 --- /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() -- GitLab