[mediacapture-image] Faster MediaStream ImageCapture.takePhoto

developer239 has just created a new issue for https://github.com/w3c/mediacapture-image:

== Faster MediaStream ImageCapture.takePhoto ==
I get MediaStream object from `navigator.mediaDevices.getUserMedia`:

```
navigator.mediaDevices.getUserMedia({
  audio: false,
  video: {
    mandatory: {
      chromeMediaSource: 'desktop',
      chromeMediaSourceId: source.id,
      minWidth: 800,
      maxWidth: 800,
      minHeight: 800,
      maxHeight: 800,
    },
  },
})
.then((stream) => {
```

I am trying to get node Buffer of **every** a still frame using ImageCapture:

```
  const track = stream.getVideoTracks()[0];
  const capturedImage = new ImageCapture(track);

  capturedImage // This takes 200ms for 1000x1000
    .takePhoto()
    .then(blob => {
      toBuffer(blob, function (err, buffer) { // 1.5 ms
        if (err) throw err;
          // TODO: Do some opencv magic with node buffer
      });
    })
    .catch(error => console.error('takePhoto() error:', error));
```

But it takes awfully long to takePhoto. Is it possible to make the process faster? Can I somehow access the `MediaStream` directly as `readable stream` in nodejs?



Please view or discuss this issue at https://github.com/w3c/mediacapture-image/issues/197 using your GitHub account

Received on Sunday, 14 January 2018 17:54:51 UTC