Chrome+另一个过程:比较进程通信比HTTP / XHR请求更快?
我有一个过程#1在视频流上进行实时图像处理。
我需要在Chrome的HTML页面(同一台计算机上的进程#2)中渲染此视频,在Canvas
或img
或video> video
中HTML5元素。
由于我有1000x1000像素x 3字节RGB,在20 fps时,这是57 MB/sec,在过程#1和过程#2(Chrome)之间发送。
测试:
使用PNG,JPG,BMP实时编码 +
Multipart/X-Mixed-Replace
。它很慢,请参阅图像数据从Python Numpy到浏览器HTML页面使用HTTP请求发送原始映像字节更好,但是在JS中接收XHR并执行
Putimagedata
,并带有如此多的数据CPU密集型,请参阅更新HTML页面上视频的帧,从传入的原始图像数据
从一个进程#1到同一计算机上的进程#2(Chrome)的过程中,有哪些选项发送超过100 mb/sec(在将来的情况下为2000x2000 pixels视频20fps)?
可以Chrome直接访问过程#1的一些数据,而无需通过HTTP瓶颈发送/接收?在过程#1和Chrome之间,与共享内存之间的过程间通信是否可能?
可以在Chrome扩展层上完成吗?
NB:过程#1用C ++或Python编写
I have a process #1 doing realtime image processing on a video stream.
I need to render this video in a HTML page in Chrome (process #2 on the same computer), in a canvas
or img
or video
HTML5 element.
Since I have 1000x1000 pixels x 3 bytes RGB, at 20 fps, this is 57 MB/sec to send between process #1 and process #2 (Chrome).
Tested:
Using PNG, JPG, BMP realtime encoding +
multipart/x-mixed-replace
. It is quite slow, see Sending RGB image data from Python numpy to a browser HTML pageSending the raw image bytes with HTTP request is better, but receiving the XHR in JS and doing
putImageData
with so much data is still CPU-intensive, see Update frames of a video on a HTML page, from incoming raw image data
What options are there to send more than 100 MB/sec (in the future case 2000x2000 pixels video 20fps) from a process #1 to process #2 (Chrome) on the same computer?
Can Chrome access some data of process #1 directly without having to send/receive via a HTTP bottleneck? Is inter-process-communication with shared memory possible between process #1 and Chrome?
Can this be done at a Chrome extension layer?
NB: Process #1 is written in C++ or Python
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可能您可以将Websocket连接用于此任务。它将仅开放一次,然后您可以通过它发送大量数据,而流量使用量的大幅减少(与HTTP请求进行了比较)。
您可以检查基本说明和示例在这里。
Probably you can use websocket connection for this task. It will be opened only one time, and then you can send lots of data through it with huge reduction of traffic usage (in comparation with http requests).
You can check basic description and examples here.