Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python live video streaming flask

def generate_frames():
    capture = cv2.VideoCapture(-1)
    while True:
        bollean , frame = capture.read()
        ret , buffer = cv2.imencode('.jpg',frame)
        frame = buffer.tobytes()
        yield (b'--frame
'
               b'Content-Type: image/jpeg

' + frame + b'
')

@app.route('/video_feed')
def video_feed():
    return Response(generate_frames(), mimetype='multipart/x-mixed-replace; boundary=frame')

 
PREVIOUS NEXT
Tagged: #python #live #video #streaming #flask
ADD COMMENT
Topic
Name
2+2 =