WebRtc to RTP to HLS

3,306 views
Skip to first unread message

robert.corolea...@gmail.com

unread,
Nov 18, 2015, 1:46:17 AM11/18/15
to kurento
Hello.
    I am using the RTP Endpoint to send a WebRtc stream to Wowza. I am processing a hard-coded sdp and also creating a .sdp file with it in the Wowza content folder. It all works fine but the delay is huge, almost 40 seconds on the HLS output. On the RTMP output of the Wowza test player the delay is 2-3 seconds. Do I need to create the sdp in a special way? It currently looks like this:

v=0
o=- 3641290734 3641290734 IN IP4 -server ip-
s=Wowza Media Server
c=IN IP4 -server ip-
t=0 0
m=audio -audio port- RTP/AVP 0
a=rtpmap:0 PCMU/8000
a=ssrc:2510709736 cname:user768193681@host-df27e8d8
m=video -video port- RTP/AVP 101
a=rtpmap:101 H264/90000
a=ssrc:2424945037 cname:user768193681@host-df27e8d8

Thanks in advance!

Stefan Hellkvist

unread,
Nov 18, 2015, 8:06:00 AM11/18/15
to kurento
If you experience low delay on the Wowza RTMP output but large delay on HLS output why do you think there is a problem with Kurento?

The HLS delay is primarily dependent on the size of each HLS segment and how many segments you have in your playlist. Since the HLS specification also says that each segment must start with an I-frame the time-between-I-frame configuration also plays a role. I have never used Wowza but check in its HLS transcoding configuration if you can control the segment size and perhaps force key frames at a shorter interval. Also see if the receiving side on Wowza has some buffer size that you can control. If you put, for instance, ffmpeg on the receiving side instead of Wowza I know you can control all of the above. All of this is outside Kurento though I'm afraid.

Stefan

serio...@gmail.com

unread,
Dec 1, 2015, 12:53:43 PM12/1/15
to kurento, robert.corolea...@gmail.com
Hi Robert,
can you explain (with some code) how do you successfully sent RTP streaming from WebRtc to wowza?

Thanks
Raoul

robert.corolea...@gmail.com

unread,
Dec 2, 2015, 2:51:07 AM12/2/15
to kurento, robert.corolea...@gmail.com
He Raoul.
The process is quite simple actually(although it won't seem like that at first.). If you have a WebRtc endpoint already you then create a RtpEndpoint. Then you make the RtpEndpoint process a hard-coded sdp string, something like this:
var sdp = 'v=0';
sdp += '\no=- 3641290734 3641290734 IN IP4 -server ip-';
sdp += '\ns=Wowza Media Server';
sdp += '\nc=IN IP4 -server ip-';
sdp += '\nt=0 0';
sdp += '\nm=audio -audio port- RTP/AVP 0';
sdp += '\na=rtpmap:0 PCMU/8000';
sdp += '\na=ssrc:2510709736 cname:user768193681@host-';
sdp += '\ndf27e8d8';
sdp += '\nm=video -video port- RTP/AVP 101';
sdp += '\na=rtpmap:101 H264/90000';
sdp += '\na=ssrc:2424945037 cname:user768193681@host-df27e8d8';

pipeline.create('RtpEndpoint', function(err, rtpEndpoint){
                                rtpEndpoint.processOffer(
sdp);
...

Replace the -server ip- with the ip of the server where your Wowza instance is installed.
Then you connect the WebRtc Endpoint to the RtpEndpoint and after this, you take the same sdp, put it in a file then put that file in the Wowza content folder. That's mostly it.
You can now start a WebRtc stream and after go to your Wowza Streaming Engine manager->Applications->live->Streaming files and you'll see the file that you've put in the content folder. Connect to it and you should have the stream incoming.
I hope this helps.

novik...@gmail.com

unread,
Jul 28, 2016, 12:38:23 PM7/28/16
to kurento, robert.corolea...@gmail.com
Sorry for writing 7 months after the original post :)
i tried all of this and it works fine. There is a problem though.
These final step takes manual intervention. What if need to create many streams as my clients come and go? How do i automate/script this?

sameer...@dynaptsolutions.com

unread,
Oct 6, 2016, 7:38:33 AM10/6/16
to kurento, robert.corolea...@gmail.com

I am in the same situation. I am creating rtpendpoint like the code below but not getting the solution that whether my sdp file is correct or playable in vlc. 



webRtcEndpoint.processOffer(sdpOffer, function(error, sdpAnswer) {
if (error) {
stop(sessionId);
return callback(error);
}

if (presenter === null) {
stop(sessionId);
return callback(noPresenterMessage);
}

callback(null, sdpAnswer);
});
presenter.pipeline.create('RtpEndpoint',function(error, rtpEndpoint){
    var sdp = 'v=0';
sdp += '\no=- 3641290734 3641290734 IN IP4 127.0.0.1';
sdp += '\ns=media server';
sdp += '\nc=IN IP4 127.0.0.1';
sdp += '\nt=0 0';
sdp += '\nm=audio -audio port- RTP/AVP 0';
sdp += '\na=rtpmap:0 PCMU/8000';
sdp += '\nm=video -video port- RTP/AVP 101';
sdp += '\na=rtpmap:101 H264/90000';

            // rtpEndpoint.setMaxVideoRecvBandwidth(12000);
            // rtpEndpoint.setMaxVideoSendBandwidth(12000);
           rtpEndpoint.processOffer(sdp, function(error, sdpAnswer){
                console.log('Offer:\n', sdp);
                console.log('Answer:\n', sdpAnswer);
            });
            presenter.webRtcEndpoint.connect(rtpEndpoint);
   }); 

jacob jake

unread,
Mar 9, 2017, 4:17:11 AM3/9/17
to kurento, robert.corolea...@gmail.com
i am using kurento 6.6.0.

just after the pipeline.create('WebrtcEndPoint', function(err, webRtcEndpoint) {
 ...
}

i add a new pipeline just next to it, this is the code

pipeline.create('RtpEndPoint', function(err, rtpEndpoint) {
...
}

and i encoutered some error, please help! :)
Reply all
Reply to author
Forward
0 new messages