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

195
Views
is there any way to send webrtc frame to python script?

I created first web app(python and django) which shows client's webcam frames
This is my video.js

'use strict';

// On this codelab, you will be streaming only video (video: true).
const mediaStreamConstraints = {
  video: true,
};

// Video element where stream will be placed.
const localVideo = document.querySelector('video');

// Local stream that will be reproduced on the video.
let localStream;

// Handles success by adding the MediaStream to the video element.
function gotLocalMediaStream(mediaStream) {
  localStream = mediaStream;
  localVideo.srcObject = mediaStream;
}

// Handles error by logging a message to the console with the error message.
function handleLocalMediaStreamError(error) {
  console.log('navigator.getUserMedia error: ', error);
}

// Initializes media stream.
navigator.mediaDevices.getUserMedia(mediaStreamConstraints)
  .then(gotLocalMediaStream).catch(handleLocalMediaStreamError);

However, I want to use client's webcam frame as an input to my machine learning script(python .py) file.
In local, it was easily done via opencv and numpy.
But in web, I cannot feed frames to ML model.
Any suggestions?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

webrtc is a peer-to-peer connection so clients can be connected to the most direct route possible, without server interference (when client-server connections are needed, webrtc is not as useful as sockets or gRPC). so if you want to redirect the data from one peer to ML model you should connect it directly to ML model as the other peer. to do so, one way would be creating a python native webrtc client for your ML model controller,in that case, you may find this GitHub repository useful.

another way for real-time connection would be a proxy controller which benefits the old-school UDP socket connection or gRPC streaming between your webrtc controller in browser and ML controller in processing service

we still have the old and battle proved socket connection (django channels) or newer cilent server options like gRPC streaming.

about 4 years ago · Juan Pablo Isaza Report
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!