I would like to ask a question regarding the use of flask in the management of the video stream: 1-> I recover the video stream from an Ip camera with the rtsp protocol 2-> with Flask I display the video but in my browser in localHsot
from flask import Flask, render_template, Response
import cv2
app = Flask(__name__)
camera = cv2.VideoCapture("rtsp://--:--@ipAdress/media.amp")
def gen_frames():
while True:
# Capture frame-by-frame
success, frame = camera.read()
#cv2.imshow('frame', frame)
print("success-------",success)
if not success:
break
else:
ret, buffer = cv2.imencode('.jpg', frame)
frame = buffer.tobytes()
yield (b'--frame\r\n'
b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n')
@app.route('/video_feed')
def video_feed():
#Video streaming route. Put this in the src attribute of an img tag
return Response(gen_frames(), mimetype='multipart/x-mixed-replace; boundary=frame')
@app.route('/')
def index():
"""Video streaming home page."""
return render_template('index.html')
if __name__ == '__main__':
app.run(debug=True)
I would like to know please, is it possible to do the display not in locahost http://127.0.0.1:5000 but to send it to an external HTML page
Thanks.