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