Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
112
rated 0 times [  115] [ 3]  / answers: 1 / hits: 23809  / 6 Years ago, wed, november 7, 2018, 12:00:00

Hi,

I am creating a pipeline where I need to access data from the camera and do some OpenCV algorithms in it. I am able to send the video from the source using webRTC. https://lostechies.com/derickbailey/2014/03/13/build-a-local-webcam-with-webrtc-in-less-than-20-lines/


But, What I need help with is how to receive the video stream in Python and do the processing. How can I access the video feed from a webRTC stream to the Python backend?


This is the javascript code running.


(function(){
var mediaOptions = { audio: false, video: true };

if (!navigator.getUserMedia) {
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
}

if (!navigator.getUserMedia){
return alert('getUserMedia not supported in this browser.');
}

navigator.getUserMedia(mediaOptions, success, function(e) {
console.log(e);
});

function success(stream){
var video = document.querySelector("#player");
video.src = window.URL.createObjectURL(stream);
}
})();


I need help in receiving the video from this Javascript using Python.


More From » python

 Answers
22

I'm the author of aiortc. Have you checked out the server example, as it illustrates how to process video using OpenCV?



https://github.com/jlaine/aiortc/tree/master/examples/server


[#53163] Thursday, November 1, 2018, 6 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
xochitl

Total Points: 559
Total Questions: 95
Total Answers: 117

Location: Antigua and Barbuda
Member since Sat, Apr 24, 2021
3 Years ago
;