Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WebRTC is not a Peer 2 Server Solution. How can I make one?

5,905 views
Skip to first unread message

michael....@binarykitchen.com

unread,
Mar 28, 2013, 8:54:48 PM3/28/13
to
Hello guys

WebRTC is obviously a Peer to Peer solution but I'm very interested to make a Peer to Server solution. I'd like to be able to store webcam recorded videos directly on the server.

But I haven't found such a solution yet and doubt it's possible with the current WebRTC implementation.

Am I right?

Cheers
Michael

Adam Roach

unread,
Mar 28, 2013, 9:32:03 PM3/28/13
to michael....@binarykitchen.com, dev-...@lists.mozilla.org
Nope. The browser-to-server use case is explicitly called out in the
RTCWEB requirements document as something we expect to support. There
should be nothing preventing you from making use of it already.

--
Adam Roach
Principal Platform Engineer
a...@mozilla.com
+1 650 903 0800 x863

Michael Heuberger

unread,
Mar 28, 2013, 9:45:41 PM3/28/13
to Adam Roach, dev-...@lists.mozilla.org
Thanks Adam

So you're saying that it should be possible? If so:
- where can I see some examples?
- what function must be called to send the video to the server?
- do Mozilla and Chrome use different video codecs for the same
implementation?

I am also confused, what's the difference between RTCWEB and WebRTC?

On 29/03/13 14:32, Adam Roach wrote:
> On 3/28/13 19:54, michael....@binarykitchen.com wrote:
> Nope. The browser-to-server use case is explicitly called out in the
> RTCWEB requirements document as something we expect to support. There
> should be nothing preventing you from making use of it already.
>
> --
> Adam Roach
> Principal Platform Engineer
> a...@mozilla.com
> +1 650 903 0800 x863

--

Binary Kitchen
Michael Heuberger
4c Dunbar Road
Mt Eden
Auckland 1024
(New Zealand)

Mobile (text only) ... +64 21 261 89 81
Email ................ mic...@binarykitchen.com
Website .............. http://www.binarykitchen.com

Adam Roach

unread,
Mar 28, 2013, 10:58:12 PM3/28/13
to Michael Heuberger, dev-...@lists.mozilla.org
On 3/28/13 20:45, Michael Heuberger wrote:
> Thanks Adam
>
> So you're saying that it should be possible? If so:
> - where can I see some examples?
> - what function must be called to send the video to the server?

While I can't point you to any ready-made examples off the top of my
head (although I suspect they exist), the general information flow for
real-time server-based recording of a media stream would be something
along the lines of:

1. Browser retrieves a webpage with javascript in it.
2. Browser executes javascript, which:
1. Gets a handle to the camera using getUserMedia,
2. Creates an RTCPeerConnection
3. Calls "createOffer" and "setLocalDescription" on the
RTCPeerConnection
4. Sends an request to the server containing the offer (in SDP format)
3. The server processes the offer SDP and generates its own answer SDP,
which it returns to the browser in its response.
4. The javascript calls "setRemoteDescription" on the RTCPeerConnection
to start the media flowing.
5. The server starts receiving DTLS/SRTP packets from the browser,
which it then does whatever it wants to, up to and including storing
in an easily readable format on a local hard drive.


Clearly, I've glossed over the details, but I hope that's enough to get
you in the right direction with a little more research on your end.

> - do Mozilla and Chrome use different video codecs for the same
> implementation?

Presently, both Mozilla and Chrome use VP8 for their video codec.

>
> I am also confused, what's the difference between RTCWEB and WebRTC?

The standardization effort to enable real-time communications in web
browsers is a cross-organizational endeavor, with the
javascript-to-browser interface being defined in the W3C's "WebRTC"
working group, and the browser-to-network interface being defined in the
IETF's "RTCWEB" working group.

The term "WebRTC" is used in the press to refer to both halves of the
effort. You won't generally see "RTCWEB" unless someone is making a
specific reference to the IETF working group.

Michael Heuberger

unread,
Mar 28, 2013, 11:21:24 PM3/28/13
to Adam Roach, dev-...@lists.mozilla.org
thanks so much for your good advice. look, i already code with node.js
and have an interesting prototype here:
https://www.videomail.io/

all i want is to improve the performance. i think i should do some
research with RTCWEB.

> 1. Browser retrieves a webpage with javascript in it.
> 2. Browser executes javascript, which:
> 1. Gets a handle to the camera using getUserMedia,
> 2. Creates an RTCPeerConnection
> 3. Calls "createOffer" and "setLocalDescription" on the
> RTCPeerConnection
> 4. Sends an request to the server containing the offer (in SDP
> format)
> 3. The server processes the offer SDP and generates its own answer
> SDP, which it returns to the browser in its response.
> 4. The javascript calls "setRemoteDescription" on the
> RTCPeerConnection to start the media flowing.
> 5. The server starts receiving DTLS/SRTP packets from the browser,
> which it then does whatever it wants to, up to and including
> storing in an easily readable format on a local hard drive.
>

makes sense but why so complicated? i want the node.js server to be
always listening for any new RTCPeerConnections and thus accepts any
incoming streams.

my second question is about the video format: in what format is the
video stream transferred and how can i store it in i.e. webm?

cheers
michael

>
> Clearly, I've glossed over the details, but I hope that's enough to
> get you in the right direction with a little more research on your end.
>
>> - do Mozilla and Chrome use different video codecs for the same
>> implementation?
>
> Presently, both Mozilla and Chrome use VP8 for their video codec.
>
>>
>> I am also confused, what's the difference between RTCWEB and WebRTC?
>
> The standardization effort to enable real-time communications in web
> browsers is a cross-organizational endeavor, with the
> javascript-to-browser interface being defined in the W3C's "WebRTC"
> working group, and the browser-to-network interface being defined in
> the IETF's "RTCWEB" working group.
>
> The term "WebRTC" is used in the press to refer to both halves of the
> effort. You won't generally see "RTCWEB" unless someone is making a
> specific reference to the IETF working group.
>
>
> --
> Adam Roach
> Principal Platform Engineer
> a...@mozilla.com
> +1 650 903 0800 x863

Eric Rescorla

unread,
Mar 29, 2013, 9:45:24 AM3/29/13
to Michael Heuberger, dev-...@lists.mozilla.org, Adam Roach

Michael Heuberger

unread,
Mar 30, 2013, 6:44:50 AM3/30/13
to Eric Rescorla, dev-...@lists.mozilla.org, Adam Roach
Thanks!

Is this an API for recording videos on the web? Is already an
implementation out there?

Michael

On 30/03/13 02:45, Eric Rescorla wrote:
> You may want the recording API:
>
> https://dvcs.w3.org/hg/dap/raw-file/tip/media-stream-capture/MediaRecorder.html
>
> On Thu, Mar 28, 2013 at 8:21 PM, Michael Heuberger
> <michael....@binarykitchen.com
> a...@mozilla.com <mailto:a...@mozilla.com>
> +1 650 903 0800 x863 <tel:%2B1%20650%20903%200800%20x863>
>
>
> --
>
> Binary Kitchen
> Michael Heuberger
> 4c Dunbar Road
> Mt Eden
> Auckland 1024
> (New Zealand)
>
> Mobile (text only) ... +64 21 261 89 81
> <tel:%2B64%2021%20261%2089%2081>
> Email ................ mic...@binarykitchen.com
> <mailto:mic...@binarykitchen.com>
> Website .............. http://www.binarykitchen.com
>
> _______________________________________________
> dev-media mailing list
> dev-...@lists.mozilla.org <mailto:dev-...@lists.mozilla.org>
> https://lists.mozilla.org/listinfo/dev-media

Robert O'Callahan

unread,
Mar 30, 2013, 3:28:54 PM3/30/13
to Michael Heuberger, dev-...@lists.mozilla.org, Eric Rescorla, Adam Roach
On Sat, Mar 30, 2013 at 11:44 PM, Michael Heuberger <
michael....@binarykitchen.com> wrote:

> Is this an API for recording videos on the web? Is already an
> implementation out there?
>

Yes. Not yet, working on it.

Rob
--
q“qIqfq qyqoquq qlqoqvqeq qtqhqoqsqeq qwqhqoq qlqoqvqeq qyqoquq,q qwqhqaqtq
qcqrqeqdqiqtq qiqsq qtqhqaqtq qtqoq qyqoquq?q qEqvqeqnq qsqiqnqnqeqrqsq
qlqoqvqeq qtqhqoqsqeq qwqhqoq qlqoqvqeq qtqhqeqmq.q qAqnqdq qiqfq qyqoquq
qdqoq qgqoqoqdq qtqoq qtqhqoqsqeq qwqhqoq qaqrqeq qgqoqoqdq qtqoq qyqoquq,q
qwqhqaqtq qcqrqeqdqiqtq qiqsq qtqhqaqtq qtqoq qyqoquq?q qEqvqeqnq
qsqiqnqnqeqrqsq qdqoq qtqhqaqtq.q"

Michael Heuberger

unread,
Mar 30, 2013, 9:11:36 PM3/30/13
to rob...@ocallahan.org, dev-...@lists.mozilla.org, Eric Rescorla, Adam Roach
Rob, very interesting! Can you tell me more about it? Can I help you
guys somehow?

Cheers
Michael

On 31/03/13 08:28, Robert O'Callahan wrote:
> On Sat, Mar 30, 2013 at 11:44 PM, Michael Heuberger
> <michael....@binarykitchen.com

Robert O'Callahan

unread,
Mar 31, 2013, 12:27:55 AM3/31/13
to Michael Heuberger, dev-...@lists.mozilla.org, Eric Rescorla, Adam Roach
On Sun, Mar 31, 2013 at 2:11 PM, Michael Heuberger <
michael....@binarykitchen.com> wrote:

> Rob, very interesting! Can you tell me more about it? Can I help you guys
> somehow?
>

https://dvcs.w3.org/hg/dap/raw-file/default/media-stream-capture/MediaRecorder.html
Feedback on the proposed spec to public-media-capture would be welcome.

Michael Heuberger

unread,
Mar 31, 2013, 9:42:08 PM3/31/13
to rob...@ocallahan.org, dev-...@lists.mozilla.org, Eric Rescorla, Adam Roach
ok, happy to study that and to provide feedback.

tell me first, where can i post feedback best? should i contact the
editors directly or better ideas?

and what's your role rob? are you working with these w3c guys?

cheers
michael

On 31/03/13 17:27, Robert O'Callahan wrote:
> On Sun, Mar 31, 2013 at 2:11 PM, Michael Heuberger
> <michael....@binarykitchen.com

kajm...@gmail.com

unread,
Oct 18, 2015, 7:20:59 AM10/18/15
to mozilla-...@lists.mozilla.org
Dear Mr. Roach,

the answer below was regarding the recording of the video stream from a webRTC peerconnection. I am currently building a webRTC-Tool where a user should be able to start a recording using webRTC. This is part of a bachelor thesis at my university.

So in the browser I get the stream using getUserMedia(). On the server side runs a NodeJS server, that currently only support datachannels. My main goal would be to send the Video- and Audio-Stream via the datachannel to the server and record it on the server. How would that be possible? Below you state "The server starts receiving DTLS/SRTP packets from the browser, which it then does whatever it wants to, up to and including storing in an easily readable format on a local hard drive."
Since the MediaRecorder-API is not completely implemented, this would currently be the only solution I could think of. Using a canvas with a 30 FPS webcam video seems fairly unrealistic.

Thank you very much in advance and excuse me for restarting such an old topic,
Kaj-Sören

Eric Rescorla

unread,
Oct 18, 2015, 10:21:10 AM10/18/15
to kajm...@gmail.com, mozilla-...@lists.mozilla.org
On Sun, Oct 18, 2015 at 3:37 AM, <kajm...@gmail.com> wrote:

> Dear Mr. Roach,
>
> the answer below was regarding the recording of the video stream from a
> webRTC peerconnection. I am currently building a webRTC-Tool where a user
> should be able to start a recording using webRTC. This is part of a
> bachelor thesis at my university.
>
> So in the browser I get the stream using getUserMedia(). On the server
> side runs a NodeJS server, that currently only support datachannels. My
> main goal would be to send the Video- and Audio-Stream via the datachannel
> to the server and record it on the server. How would that be possible?
> Below you state "The server starts receiving DTLS/SRTP packets from the
> browser, which it then does whatever it wants to, up to and including
> storing in an easily readable format on a local hard drive."
> Since the MediaRecorder-API is not completely implemented, this would
> currently be the only solution I could think of. Using a canvas with a 30
> FPS webcam video seems fairly unrealistic.
>
> Thank you very much in advance and excuse me for restarting such an old
> topic,
>

Yes, either you have to use MediaRecorder (and I don't know if it's
implemented enough
to do what you want) or implement DTLS-SRTP on the server side. Note that
if you use
MediaRecorder, you don't need to use Data Channels. Just send the frames up
via
ordinary Web mechanisms such as XHR/WebSockets.

-Ekr


> Kaj-Sören
>
> On Friday, March 29, 2013 at 3:58:12 AM UTC+1, Adam Roach wrote:
> _______________________________________________
> dev-media mailing list
> dev-...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-media
>

Maire Reavy

unread,
Oct 18, 2015, 12:03:40 PM10/18/15
to mozilla-...@lists.mozilla.org, kajm...@gmail.com
MediaRecorder should work for your purposes; you can either record a single
Blob and then send it up, or get periodic blobs from MediaRecorder and send
them up as you get them. We've also recently added support for bitrate
control in MediaRecorder (in Firefox 43); the current release of Firefox
uses a fixed video bitrate of 2.5Mbps.

If you have any problems, file a bug (in Product: Core, Component:
Audio/Video: Recording) or ask questions here, or on IRC in #media.

-Maire

On Sun, Oct 18, 2015 at 10:20 AM, Eric Rescorla <e...@rtfm.com> wrote:

> On Sun, Oct 18, 2015 at 3:37 AM, <kajm...@gmail.com> wrote:
>
> > Dear Mr. Roach,
> >
> > the answer below was regarding the recording of the video stream from a
> > webRTC peerconnection. I am currently building a webRTC-Tool where a user
> > should be able to start a recording using webRTC. This is part of a
> > bachelor thesis at my university.
> >
> > So in the browser I get the stream using getUserMedia(). On the server
> > side runs a NodeJS server, that currently only support datachannels. My
> > main goal would be to send the Video- and Audio-Stream via the
> datachannel
> > to the server and record it on the server. How would that be possible?
> > Below you state "The server starts receiving DTLS/SRTP packets from the
> > browser, which it then does whatever it wants to, up to and including
> > storing in an easily readable format on a local hard drive."
> > Since the MediaRecorder-API is not completely implemented, this would
> > currently be the only solution I could think of. Using a canvas with a 30
> > FPS webcam video seems fairly unrealistic.
> >
> > Thank you very much in advance and excuse me for restarting such an old
> > topic,
> >
>
> Yes, either you have to use MediaRecorder (and I don't know if it's
> implemented enough
> to do what you want) or implement DTLS-SRTP on the server side. Note that
> if you use
> MediaRecorder, you don't need to use Data Channels. Just send the frames up
> via
> ordinary Web mechanisms such as XHR/WebSockets.
>
> -Ekr
>
>
> > Kaj-Sören
> >
> > On Friday, March 29, 2013 at 3:58:12 AM UTC+1, Adam Roach wrote:
> > _______________________________________________
> > dev-media mailing list
> > dev-...@lists.mozilla.org
> > https://lists.mozilla.org/listinfo/dev-media
> >
> _______________________________________________
> dev-media mailing list
> dev-...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-media
>



--
Maire Reavy
mre...@mozilla.com

michael.heuberg...@gmail.com

unread,
Oct 19, 2015, 10:52:45 AM10/19/15
to mozilla-...@lists.mozilla.org
I do not recommend MediaRecorder, since it is not implemented in all Browsers. Using websockets to send frames to the server already works very well for my prototype www.videomail.io - check it out, it is open source and available on npm: https://github.com/binarykitchen/videomail-client

Cheers
Michael

Maire Reavy

unread,
Oct 19, 2015, 11:00:19 AM10/19/15
to michael.heuberg...@gmail.com, mozilla-...@lists.mozilla.org
On Sun, Oct 18, 2015 at 5:19 PM, <michael.heuberg...@gmail.com>
wrote:
That certainly is a viable alternative. I will say that MediaRecorder is
coming to browsers very soon. Firefox has it. Chrome has video support
for MediaRecorder, and they are actively working on audio. It is the most
starred bug in all of Chrome (not just all of WebRTC -- all of Chrome). It
is the hot new feature, and you could get ahead of the curve by starting to
use it now. And I certainly would appreciate getting more devs using it in
Firefox.

-Maire

--
Maire Reavy
mre...@mozilla.com

kajm...@gmail.com

unread,
Oct 19, 2015, 4:14:16 PM10/19/15
to mozilla-...@lists.mozilla.org
Good evening Maire,

and I certainly will use it ;) I actually got it working quite beautifully sending the blobs over to my server (actually turning them into base64 to be able to handle them in nodeJS). That got me thinking though:

Are the blobs completely encoded containing all the mediadata or is it the raw video data? The latter would enable to just stich the blobs together in one file. The reason why I am asking is, that in my solution right now only the first two seconds of my recording (mediarecorder.start(2000)) play back without hickups, when I put all the blobs into one file.

Thank you very much ahead,
Kaj-Sören

Michael Heuberger

unread,
Oct 19, 2015, 4:57:49 PM10/19/15
to mozilla....@googlegroups.com, mozilla-...@lists.mozilla.org, michael.heuberg...@gmail.com
Thanks but I won't switch until the MediaRecorder is fully implemented
on all major browsers. Cannot risk breakage for a heavily used
webservice.

I ll observe this closely and see how it goes ...

- Michael

---
Binary Kitchen
Michael Heuberger
1/33 Parrish Road
Sandringham
Auckland 1025
(New Zealand)

Mobile (text only) ... +64 21 261 89 81
Email ................ mic...@binarykitchen.com
Website .............. http://www.binarykitchen.com

Maire Reavy

unread,
Oct 21, 2015, 2:01:53 PM10/21/15
to Kaj, mozilla-...@lists.mozilla.org
I think the simple answer to your question is the server will need to
stitch multiple independent blobs into one seamless media file.

Cheers
-Maire

Alexander Abagian

unread,
Nov 20, 2015, 10:11:13 AM11/20/15
to mozilla-...@lists.mozilla.org
If you are family with C++ you could retrieve needed libs (webrtc, nicer etc.) from FireFox or Chromium and build your own recording server. Or use WebRTC Native code. If you prefer Java take Jitsi Video Bridge and hack it.

ngui...@village88.com

unread,
Aug 17, 2016, 12:02:09 AM8/17/16
to mozilla-...@lists.mozilla.org
Hello Michael,

It's almost 1 year since this thread was created and I just want to ask you, did you stay on your prototype or did you consider the MediaRecorder?

Michael Heuberger

unread,
Aug 17, 2016, 12:07:00 AM8/17/16
to dev-...@lists.mozilla.org
good question. i consider to switch to mediarecorder when it is stable
and also working on microsoft browsers like IE or Edge

zeu...@gmail.com

unread,
Oct 30, 2016, 3:03:29 PM10/30/16
to mozilla-...@lists.mozilla.org
hi man, nice work. Do u have some examples about peer 2 server?
0 new messages