使用python opencv实时接收webRTC视频流 [英] Receive webRTC video stream using python opencv in real-time

查看:1414
本文介绍了使用python opencv实时接收webRTC视频流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在创建一个管道,需要在其中访问摄像机的数据并在其中执行一些opencv算法.我可以使用webRTC从源发送视频. https://lostechies.com/derickbailey/2014/03/13/build-a-local-webcam-with-webrtc-in-less-than-20-lines/

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

但是,我需要帮助的是如何在python中接收视频流并进行处理.如何从webRTC流向python后端访问视频提要?

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

这是正在运行的javascript代码.

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);
  }
})();

在使用python从此Java脚本接收视频时,我需要帮助.

I need help in receiving the video from this java script using python.

推荐答案

我是aiortc的作者.您是否已经查看了server示例,该示例说明了如何使用OpenCV处理视频?

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/示例/服务器

这篇关于使用python opencv实时接收webRTC视频流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆