Title:
Intent to Implement: Media Stream Recording API
Body:
Contact emails
Spec
http://www.w3.org/TR/mediastream-recording/
Summary
An API for media stream recording. Allows web applications to record encoded media streams.
Motivation
getUserMedia makes raw media input available to web apps, but apps currently have no way to access the media streams after encoding. This has led to workarounds like recorder.js (https://github.com/mattdiamond/Recorderjs using web audio, https://github.com/jwagener/recorder.js/ for Flash-based recording) and weppy (movie recording as raw image sequences - http://antimatter15.github.io/weppy/demo.html) for video. The media files so produced are extremely bulky compared to compressed and encoded formats.
Specific applications that would benefit from this capability are audio recording apps, screen recording, video editing and compositing, and communications apps (such as Hangouts), which all currently require plugins or NaCl libraries to achieve acceptable performance.
Compatibility Risk
Small to medium. One of the authors of the spec is Travis Leithead from Microsoft. Mozilla is currently actively working on this (http://lists.w3.org/Archives/Public/public-media-capture/2013Jul/0016.html , https://bugzilla.mozilla.org/show_bug.cgi?id=803414 ).
This is still a working draft. There are e.g. discussions about changing the API to support promises.
Ongoing technical constraints
None
Will this feature be supported on all five Blink platforms (Windows, Mac, Linux, Chrome OS and Android)?
The plan is to target all platforms where getUserMedia and WebRTC is available. This includes all of the above, some in experimental form.
OWP launch tracking bug?
Doesn’t exist for now. Will be created.
Row on feature dashboard?
Yes, needs to be created.
Requesting approval to ship?
No
OK, sounds good.
Just please keep in mind that Blobs have a bit of extra cost in Chrome.
-Darin
I'm not arguing for ArrayBuffer. I just want to make sure people have considered the impact of blobsbeing backed by data held by the browser.
To be clear, the API under discussion is for exposing the result of /encoding/ a video stream, not /decoding/ or post-processing it.While the source of the stream's frames is the browser process (for most scenarios), the encoder runs in the renderer for security/sandboxing reasons, and because it matches chrome's general process split model better. Someday soon the encoder may run in the GPU process when we have HW-accelerated encoding, but it doesn't seem likely that the encoder would ever run in the browser process.Most/all output from the video encoder is destined for other processes (either for saving to disk or for sending on the network) so I suspect the right thing to do is to make the encoders emit their output to shared memory in the first place to minimize copying of encoded bits, and to allow cross-process access to them. Certainly this is the plan for HW-accelerated video encode, if only b/c that happens in the GPU process and we don't want to incur the extra copy to ship it to the renderer.
Darin: if Blobs can wrap shared-memory segments are you still concerned with "spamming the browser process with a lot of blobs"?Is there guidance on what makes the difference between "spamming" and "prudent use"? :)
Harald: Darin is talking about the possibility of a compromised renderer mutating the shared memory after handing a handle off to the browser (i.e. exploiting the mutability of the proposed implementation of Blob, ignoring the immutability of Blob's API).Darin: agreed that this should be kept in mind during implementation. I suspect that the result will be that the browser never inspects the bits in these SHMs, only ever handing them off to other processes or sockets, and that all receivers of such data will treat it the same as encoded media data from the web - as untrusted potentially malicious bits.
On Wed, Jul 17, 2013 at 12:22 PM, Ami Fischman <fisc...@chromium.org> wrote:
Harald: Darin is talking about the possibility of a compromised renderer mutating the shared memory after handing a handle off to the browser (i.e. exploiting the mutability of the proposed implementation of Blob, ignoring the immutability of Blob's API).Darin: agreed that this should be kept in mind during implementation. I suspect that the result will be that the browser never inspects the bits in these SHMs, only ever handing them off to other processes or sockets, and that all receivers of such data will treat it the same as encoded media data from the web - as untrusted potentially malicious bits.Yeah, hopefully it's a non-issue.Note: the browser will need to map these blobs when writing them to files or sending them over the network, but that would just be a temporary thing. The "spamming" concern is about using up browser memory / address space.
This is great news. I actually wanted to port recently an existing lib [1] I wrote in AS3 a few years back and it was brutal to have to rely on Web Audio for that. I shared some thoughts here [2].A few more thoughts:1. I am sorry if I missed that in the spec, but it seems like the data is encoded to specific formats, which is very cool. But for best flexibility, why not still provide the raw PCM samples as an option when it comes to audio? This would first, simplify largely the way you retrieve the stream (no Web Audio required), but also allow people to write the encoders they want using typed arrays if needed. Additionally, what if you want to access the samples to draw a simple spectrum like [3]. Again, having a very simple way to access the incoming raw samples would be very flexible.
2. If such raw samples were exposed. It would also be convenient to have both channels interleaved already (not like with Web Audio with getChannelData) or make this optional, so that we don't have to store both channels to interleave them later manually.
Den 2013-07-16 18:23:19 skrev Greg Billock <gbil...@chromium.org>:What is the lifespan of these objects? Blobs can be converted to url strings through the createObjectURL method and I wonder if that means that blobs have to be kept around indefinitely? When blobs refer to files they are cheap since all you need is a url <-> file name mapping but if they are going to refer to an in-memory representation of a media recording that can be MBs or GBs in size, then it matters quite a lot.
I'd expect the latency cost of the Blobs to be the biggest worry. I think we can likely manage that, >but it is a good question. I'll do some investigation along those lines.
Do you think the API should use, for example, ArrayBuffer instead of Blob? Harald can likely point us >to discussions of this nature if they've been had.