Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

385
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!