2

I am trying to record stream from html5 video tag and since I can not achieve 60FPS in JS with canvas I was wondering can I do it from chrome plugin?

Any ideas is it even possible and what are the places to start?

thanks w

wonglik
  • 1,043
  • 4
  • 18
  • 36
  • I think it's not possible as today. – Dinh Viêt Hoà Mar 12 '14 at 16:39
  • @caffinatedmonkey true but documentation and examples on ppapi are quite sparse so was wondering if somebody knows about it / know good place where to start digging. – wonglik Mar 12 '14 at 19:42
  • @caffinatedmonkey I am definitely not an expert in that subject but does OpenGL allow to capture browser/OS screen. As far as I am aware it gives access to openGL windows only. Isn't it so? – wonglik Mar 12 '14 at 21:20

3 Answers3

3

You can accomplish this by using the chrome.desktopCapture or navigator.getUserMedia and MediaStreamRecorder APIs. chrome.desktopCapture and navigator.getUserMedia are experimental and MediaStreamRecorder is still unimplemented in chrome.

Currently there is no way to accomplish 60FPS recording in chrome, but support is on the way!

There are .webm encoders with caveats. Try whammy.js

NaCl support for manipulating streams is on the bleeding edge and should allow you to record to a file. Bleeding to stable takes approximately 11 weeks.

0xcaff
  • 13,085
  • 5
  • 47
  • 55
  • desktoCapture and getUserMedia works fine. but as you said, I can not get close to 60FPS. That's why I was wondering if PPAPI would be way to go, but I guess it won't work either. – wonglik Mar 12 '14 at 22:43
  • As far as I know the PPAPIs have no way of manipulating streams, but support is on the way! – 0xcaff Mar 16 '14 at 14:49
1

(I have zero stackoverflow reputation, so I can't comment on answers, but I can submit answers???).

rwu's answer is going to be the best going forward. The new MediaStreamTrack Pepper interfaces should be working on dev channel and Canary Chrome, if you build with a very recent NaCl SDK (probably canary would be best).

The API is here for video: https://code.google.com/p/chromium/codesearch#chromium/src/ppapi/cpp/media_stream_video_track.h&l=27

It's experimental, dev-channel, so it's subject to change, and it is not available to all users yet. But it's being worked on right now and should only get better & faster over time. We hope to support it as a stable API in a coming version of Chrome.

If you want to get the best performance, and you're willing to bear with some churn, and don't need something you can ship today, please start experimenting with that API and file bugs at new.crbug.com.

dmichael
  • 21
  • 2
0

If what you want is to record a MediaStream, the MediaStreamRecorder probably the best option. However as caffinatedmonkey pointed out, it's not yet implemented in chrome. crbug.com/262211 tracks this work.

However there's another option with a new set of ppapi (added in chrome 34, currently under experiment) which allows the plugin to get audio/video data from a mediastreamtrack. I think that may fit your need. For detail, please take a look at the examples in below links: http://src.chromium.org/viewvc/chrome/trunk/src/ppapi/examples/media_stream_audio/ http://src.chromium.org/viewvc/chrome/trunk/src/ppapi/examples/media_stream_video/

rwu
  • 9
  • 1
  • Try to compile your example. Some of the calls seem to be invalid. `var_track.is_resource()` and `var_track.AsResource()` Support is on the way, but these essential methods are currently un-implemented in the dev branch. They are implemented on the bleeding edge but unless you want to make all of your users compile and use chromium this is not a viable solution. – 0xcaff Mar 14 '14 at 14:18
  • The example is also part of the nacl sdk: https://code.google.com/p/chromium/codesearch#chromium/src/native_client_sdk/src/examples/api/media_stream_video/ – rwu Mar 17 '14 at 23:50
  • It looks like bleeding edge. – 0xcaff Mar 18 '14 at 15:20