# Live-Streaming-using-OpenCV-Flask **Repository Path**: x_c9311/Live-Streaming-using-OpenCV-Flask ## Basic Information - **Project Name**: Live-Streaming-using-OpenCV-Flask - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2022-02-14 - **Last Updated**: 2022-02-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Live-Streaming-using-OpenCV-Flask A Flask Web-App to stream live from local webcam or CCTV (rtsp link) ## Use Built-in Webcam of Laptop ### Put Zero (O) in cv2.VideoCapture(0) ``` cv2.VideoCapture(0) ``` ### Use Ip Camera/CCTV/RTSP Link ``` cv2.VideoCapture('rtsp://username:password@camera_ip_address:554/user=username_password='password'_channel=channel_number_stream=0.sdp') ``` ### Example RTSP Link ``` cv2.VideoCapture('rtsp://mamun:123456@101.134.16.117:554/user=mamun_password=123456_channel=0_stream=0.sdp') ``` ### Change Channel Number to Change the Camera ``` cv2.VideoCapture('rtsp://mamun:123456@101.134.16.117:554/user=mamun_password=123456_channel=1_stream=0.sdp') ``` ### Display the resulting frame in browser ``` cv2.imencode('.jpg', frame)[1].tobytes() ``` ### Or this one ``` net , buffer = cv2.imencode('.jpg', frame) buffer.tobytes() ``` ### [Reference](https://blog.miguelgrinberg.com/post/video-streaming-with-flask)