Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

379
Vistas
How to get live video stream from the browser (client webcam) with HTML to the server (Flask)?

I want to get live streaming from the client in my web to process it (face recognition and so on) and then display it back to his web.

I already manage to do it with my own camera (host), but I didn't find a solution to do it with the clients webcam.

this is my main code right now:

from flask import Flask, render_template, Response
from camera import VideoCamera

app = Flask(__name__)


@app.route('/')
def index():
    return render_template('index.html')

def gen(camera):
    while True:
        frame = camera.get_frame()
        yield (b'--frame\r\n'
               b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n\r\n')


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


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5000, threaded=True, use_reloader=False)

The VideoCamera class, capture my webcam (cv2.videocapture(0)) reading teh frames (with the ge_frame() func) process it and then return the image with encoding to jpeg to bytes.

The html part:

<html lang="en">
  <head>
    <title>Face Detector</title>
  </head>
  <body>
    <h1>Face Recognition</h1>
       <img
    src="http://localhost:5000/video_feed"
    alt="loading video stream..."
   />
  </body>
</html>

How can I do it with the clients webcam?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda