使用 python 的 WebRTC [英] WebRTC with python
问题描述
我想用 python/twisted 制作一个流媒体服务器,它接收一个 WebRTC 视频流,然后对其应用一些 OpenCV 算法.
I would like to make a streaming server with python/twisted, which receives a WebRTC video stream and then applys some OpenCV algorithms to it.
但是我找不到用于 WebRTC 的 Python 模块.如何使用 python/twisted 发送和接收 WebRTC 视频流?
However I cannot find a python module for WebRTC. How can I send and receive a WebRTC video stream with python/twisted?
谢谢!
推荐答案
你能做的就是不断地截取屏幕截图并将它们推送到 websocket,让你的扭曲服务器在每一个进来时都能看到它.
What you can do is take screen shots continuously and push them to a websocket and allow your twisted server to take a gander at each one as it comes in.
我修改了一些常见的记录器,我的版本采用 Jpeg 图像并将它们推送到 websocket.随意使用和修改您想要的方式,使其适合您的需求.此处提供源代码.我使用的示例是向下推送到一个用 C 语言构建的 libwebsocket 服务器,但可以使用相同的 javascript 发送到任何 websocket 服务器.
I have modified some common recorders and my version takes Jpeg images and pushes them over a websocket. Feel free to use and modify how you want so that it fits your needs. Source code here. The example I use is pushing down to a libwebsocket server built in C but the same javascript could be used to send to any websocket server.
这篇关于使用 python 的 WebRTC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!