Skip to content

Latest commit

 

History

History
51 lines (44 loc) · 1.41 KB

README.md

File metadata and controls

51 lines (44 loc) · 1.41 KB

Camera streaming(Open-CV + Flask) and display on different threads with safe synchronization

pip install requirements.txt

Run Server

python app.py

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:[email protected]:554/user=mamun_password=123456_channel=0_stream=0.sdp')

Change Channel Number to Change the Camera

cv2.VideoCapture('rtsp://mamun:[email protected]:554/user=mamun_password=123456_channel=1_stream=0.sdp')

Display the resulting frame in browser

cv2.imencode('.jpg', frame)[1].tobytes()

Display the resulting frame in window

Write this end of the line camera.py
if __name__ == "__main__" :
    cap = CameraStream().start()
    while True :
        frame = cap.read()
        cv2.imshow('webcam', frame)
        if cv2.waitKey(1) == 27 :
            break
    cap.stop()
    cv2.destroyAllWindows()      

Credit