Awesome Open Source
Awesome Open Source

Live Streaming and Face Detection with Flask

pip install -r 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:[email protected]_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

Instead of return use this in camera.py

cv2.imshow('frame', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
       break

Learn More

Learn More about Streaming with flask


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
python (55,393
flask (537
streaming (307
face-detection (194
rtsp (68
video-streaming (63
live-streaming (34