Get rtp stream on server

1,950 views
Skip to first unread message

Andrew Kozlov

unread,
Dec 10, 2014, 1:30:47 AM12/10/14
to kur...@googlegroups.com
Hello. Now I connect webrtc from clients to httpgetendpoint, get address and pass it to my app on server. But Rtp stream is more suitable for it. How should I build pipeline(node is) and more important how can I get full rtp address of stream?

Ivan Gracia

unread,
Dec 10, 2014, 8:59:40 AM12/10/14
to Kurento Public
Just create an rtp endpoint, instead of the http endpoint, and connect. The process of connecting two endpoints is the same, regardless of their type.

As for the rtp address, you will have to do the appropriate negotitations: create an SDP offer, and process by each client, sending back the SDP answer.

Ivan Gracia



On Wed, Dec 10, 2014 at 6:30 AM, Andrew Kozlov <sazor...@gmail.com> wrote:
Hello. Now I connect webrtc from clients to httpgetendpoint, get address and pass it to my app on server. But Rtp stream is more suitable for it. How should I build pipeline(node is) and more important how can I get full rtp address of stream?

--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andrew Kozlov

unread,
Dec 12, 2014, 2:32:10 PM12/12/14
to kur...@googlegroups.com
So I should parse address from json sdpOffer? How can I do this?

среда, 10 декабря 2014 г., 16:59:40 UTC+3 пользователь igracia написал:

Ivan Gracia

unread,
Dec 13, 2014, 6:33:08 PM12/13/14
to Kurento Public
It's not only enough to get and address form the sdp offer: you will have to do the negotiation between the client rtp endpoint (wherever you want to show the video) and the RTPendpoint in KMS. Let's say that your client is the one generating the offer, so you'll have to:
  1. Send the SDP offer to the KMS.
  2. Have the RTP endpoint in KMS process de SDP offer received, which will generate an answer. This will be somethings like the following Java code.
    • String sdpAnswer = rtpEndpoint.processOffer(sdpOffer)
  3. Send the sdpAnswer to the client that generated the offer, and process it.
Could you please describe your application a bit?

Ivan Gracia


Andrew Kozlov

unread,
Dec 14, 2014, 9:41:19 AM12/14/14
to kur...@googlegroups.com
Before my intervention it was regular application which gets video stream from webcam and analyzes it (get some info about people such as gender). This app was written without me and i need to transform it to saas. So i need to get video stream from client`s webcam via webrtc and transfer it to my server (some kind of bridge webrtc -> rtp). After that application should receive this stream from some address (like http address in case of httpget endpoint) and return some statistics to client.

воскресенье, 14 декабря 2014 г., 2:33:08 UTC+3 пользователь igracia написал:

Ivan Gracia

unread,
Dec 15, 2014, 5:05:00 AM12/15/14
to Kurento Public
If you want to serve the video through RTP, you will have to go through the negotiation process, sending the client's SDP ofer to the server (or the other way around). 

For the webrtc part, any other tutorial that we have with webrtc will do. Then, create the rtp endpoint in the server, and just webrtcEP.connect(rtpEP)

Ivan Gracia


Andrew Kozlov

unread,
Dec 22, 2014, 4:41:38 PM12/22/14
to kur...@googlegroups.com
Negotiation was successful. I write this code 
pipeline.create('WebRtcEndpoint', function(error, webRtc) {
pipeline.create('RtpEndpoint', function(error, Rtp){
webRtc.connect(Rtp, function(error){
console.log(Rtp);
webRtc.processOffer(sdpOffer, function(error, sdpAnswer) {
if (error) {
pipeline.release();
return callback(error);
}
console.log(sdpAnswer);
pipelines[sessionId] = pipeline;
return callback(null, sdpAnswer);
});
});
});

sdpAnswer is:

v=0

o=- 3719649243251346151 0 IN IP4 0.0.0.0

s=TestSession

c=IN IP4 0.0.0.0

t=0 0

a=group:BUNDLE audio video

m=audio 47611 RTP/SAVPF 0

c=IN IP4 192.168.51.208

a=rtpmap:0 PCMU/8000

a=sendrecv

a=rtcp:47611 IN IP4 192.168.51.208

a=ice-ufrag:rGbt

a=ice-pwd:o8SxDSLHlLx3JRjIDZuoAf

a=fingerprint:sha-256 91:1F:93:1B:24:18:78:65:4F:06:FB:01:4E:05:8D:AB:C1:65:38:13:13:97:EA:4B:77:A1:1F:27:94:F0:A0:AC

a=rtcp-mux

a=candidate:1 1 UDP 2013266431 192.168.51.208 47611 typ host

a=ssrc:3774244161 cname:user2339755957@host-75a473c

m=video 47611 RTP/SAVPF 100

c=IN IP4 192.168.51.208

a=rtpmap:100 VP8/90000

a=sendrecv

a=rtcp-fb:100 ccm fir

a=rtcp-fb:100 nack

a=rtcp-fb:100 nack pli

a=rtcp:47611 IN IP4 192.168.51.208

a=ice-ufrag:rGbt

a=ice-pwd:o8SxDSLHlLx3JRjIDZuoAf

a=fingerprint:sha-256 91:1F:93:1B:24:18:78:65:4F:06:FB:01:4E:05:8D:AB:C1:65:38:13:13:97:EA:4B:77:A1:1F:27:94:F0:A0:AC

a=rtcp-mux

a=candidate:1 1 UDP 2013266431 192.168.51.208 47611 typ host

a=ssrc:1872238046 cname:user2339755957@host-75a473c

(192.168.51.208 is server)
So all seems to be normal. But how I can get video? I try to test it by use:
avprobe rtp://192.168.51.208:47611
And get error 'bind failed: Address already in use'.
It seems like I don't understand something about rtp streams. I could use VLC to play video stream when using HttpGetEndpoint. Could I do the same with Rtp? 
 
понедельник, 15 декабря 2014 г., 13:05:00 UTC+3 пользователь igracia написал:

Ivan Gracia

unread,
Jan 2, 2015, 11:12:05 AM1/2/15
to Kurento Public
That's the SDP answer for the webrtc endpoint. You´ll need to make another negotiation for the RTP endpoint, with whatever client you are using.

Ivan Gracia


Alex Moskalenko

unread,
Apr 5, 2016, 4:10:25 AM4/5/16
to kurento
Hello,

Guys, could you please provide more details about SDP offer and SDP answer when connecting via RtpEndpoint?
Which IP and where I need to use in case kurento and ffmpeg are located on different servers?
For example: kurento is located on 192.168.0.5 and ffmpeg on 192.168.0.10.

Also, it would be nice if you could provide some code in nodejs.
I'm totally stuck on this point.

Thanks!
Alex

Ivan Gracia

unread,
Apr 7, 2016, 8:30:47 AM4/7/16
to Kurento Public
There are some posts about this in the list. Check this one, for instance.

Ivan Gracia



--

gycgjl12...@gmail.com

unread,
Apr 12, 2016, 4:59:28 AM4/12/16
to kurento
Hey~I know what the negotiation is going on but Im wondering that if the rtpendpoint (has processed offer one sdp) can process another sdp?
Im try to write a monitor module. Here is the situation:
 1.there are several kms;
 2.use rtpendpoint as a bridge to connect two webrtcendpoints.
So every video publisher will hava a rtpendpoint that has connected their own webrtcendpoint to wait another video publisher's rtpendpoint to negotiate. However, after the connection established, if one of them is going to reconnect and the old info ( pipeline,webrtcendpoint,rtpendpoint... ) is disposed and new info is created,here the sdp negotiation comes again ! Can the waiting publisher's rtpendpoint still process the new sdp?

在 2014年12月14日星期日 UTC+8上午7:33:08,igracia写道:

Ivan Gracia

unread,
Apr 13, 2016, 9:35:39 AM4/13/16
to Kurento Public
I'm afraid renegotiation is not supported at the moment.

Ivan Gracia


gycgjl12...@gmail.com

unread,
Apr 14, 2016, 11:22:49 PM4/14/16
to kurento
Oh~~~thank you! I have create another rtpendpoint to solve this~
But I have to kill the rtpendpoint in the pre kms when I want to change to another kms, is the function : rtpendpoint.release() exited or worked?

在 2016年4月13日星期三 UTC+8下午9:35:39,igracia写道:

Ivan Gracia

unread,
Apr 15, 2016, 3:25:08 AM4/15/16
to Kurento Public

Yeash, release is definitely the way to go if you want to get rid of an endpoint.


Ivan Gracia


gycgjl12...@gmail.com

unread,
Apr 15, 2016, 4:37:23 AM4/15/16
to kurento
Thank you for your answer, I have checked it~
I have to ask you another question : does the endpoint have an event I can emit when there is no connection on him? Im try to check the original codes and I find the event.js in kurento-client-core/lib but it is filled with notes....

@_@
Neo Geng

在 2016年4月15日星期五 UTC+8下午3:25:08,igracia写道:

Ivan Gracia

unread,
Apr 16, 2016, 6:35:56 AM4/16/16
to Kurento Public
By connection you mean incoming/outgoing media, or that it's not connected to any other endpoint? Check this other thread for that info.

Ivan Gracia


Reply all
Reply to author
Forward
0 new messages