Help needed to connect RtpEndpoint to WebRtcEndpoint

457 views
Skip to first unread message

Blobby

unread,
Oct 29, 2016, 9:02:22 AM10/29/16
to kurento

Hi,

I am having trouble trying to view a stream in a browser that is being sent to an RtpEndpoint


i.e 

Browser  <-- WebRtpEndpoint <-- RtpEndpoint <-- ffmpeg (sending content)


{code}


String offer = "v=0\r\no=- 0 0 IN IP4 0.0.0.0\r\ns=\r\nc=IN IP4 0.0.0.0\r\nt=0 0\r\n"
+ "m=audio 5005 RTP/AVPF 96\r\na=rtpmap:96 opus/48000/2\r\na=sendonly\r\n"
+ "m=video 5000 RTP/AVPF 103\r\na=rtpmap:103 H264/90000\r\na=sendonly";



  rtpEndpoint = new RtpEndpoint.Builder(pipeline).build();
 rtpEndpoint.connect(webRtcEndpoint);
  
 rtpEndpoint.processOffer(offer);

 //webRtcEndpoint processing web browser client sdpoffer
 String sdpAnswer = webRtcEndpoint.processOffer(sdpOffer);

 //send sdpAnswer back to browser js client
{code}


sending content to RtpEndpoint via ffmpeg example:

ffmpeg -re -i ~/Desktop/Pesto.mp4 -vcodec copy -an -f rtp rtp://<kms-ip>:49950


any ideas or examples on what im doing wrong?

Thanks in advance.






Ivan Gracia

unread,
Oct 29, 2016, 1:48:11 PM10/29/16
to Kurento Public
Basically you are negotiating the RtpEndpoint wrong. You need to generate an offer, and then use that offer in your ffmpeg command, so that it knows where to send the media.

Ivan Gracia



--
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+unsubscribe@googlegroups.com.
To post to this group, send email to kur...@googlegroups.com.
Visit this group at https://groups.google.com/group/kurento.
To view this discussion on the web visit https://groups.google.com/d/msgid/kurento/13a36186-85e1-4fee-a799-3f8dc6e2c6a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Blobby

unread,
Oct 29, 2016, 2:52:33 PM10/29/16
to kurento
Hi Ivan,

Many thanks for your prompt response, as i'm fairly new to media streaming can you provide me with an example of the ffmpeg command using an SDP offer?

Generating the SDP offer from the RtpEndpoint will be OK 

i.e. rtpEndpoint.generateOffer() 

Im assuming I will just use the SdpAnswer from the above example in the ffmpeg command.

Many thanks






Many thanks. 

Ivan Gracia



To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.

Blobby

unread,
Oct 30, 2016, 6:22:30 AM10/30/16
to kurento
Hello, 

So i took your advice and its still not working. I did the following two tests:
(Note I'm using a kurento docker container)

Test 1:

1. rtpEndpoint.generateOffer() 

which generated: 

v=0
o=- 3686810655 3686810655 IN IP4 172.17.0.2
s=Kurento Media Server
c=IN IP4 172.17.0.2
t=0 0
m=audio 43752 RTP/AVPF 96 0 97
a=rtpmap:96 opus/48000/2
a=rtpmap:97 AMR/8000
a=mid:audio0
a=ssrc:1011511992 cname:user3805843211@host-f93e8e23
m=video 63832 RTP/AVPF 102 103
a=rtpmap:102 VP8/90000
a=rtpmap:103 H264/90000
a=mid:video0
a=rtcp-fb:102 nack
a=rtcp-fb:102 nack pli
a=rtcp-fb:102 ccm fir
a=rtcp-fb:103 nack
a=rtcp-fb:103 nack pli
a=rtcp-fb:103 ccm fir
a=ssrc:864524880 cname:user3805843211@host-f93e8e23

2. the webRtcEndpoint processed the browser offer and generated the following sdp answer (which was sent back to the browser client)

v=0
o=- 3686810655 3686810655 IN IP4 0.0.0.0
s=Kurento Media Server
c=IN IP4 0.0.0.0
t=0 0
a=msid-semantic: WMS
a=group:BUNDLE audio video
m=audio 1 UDP/TLS/RTP/SAVPF 111 0
a=mid:audio
a=rtcp:9 IN IP4 0.0.0.0
a=rtpmap:111 opus/48000/2
a=rtpmap:0 PCMU/8000
a=setup:active
a=sendonly
a=rtcp-mux
a=fmtp:111 minptime=10;useinbandfec=1
a=ssrc:2213323915 cname:user2209928997@host-dbfe2687
a=ice-ufrag:aJGl
a=ice-pwd:AS3QOA1VPZHX51A2+otzRz
a=fingerprint:sha-256 3E:05:0F:75:E0:2B:3D:CD:1E:27:D2:FB:CA:C1:FD:C0:E5:38:77:A0:AA:FC:0E:A0:CF:33:DD:4D:BF:41:8A:CA
m=video 1 UDP/TLS/RTP/SAVPF 100
a=mid:video
a=rtcp:9 IN IP4 0.0.0.0
a=rtpmap:100 VP8/90000
a=rtcp-fb:100 ccm fir
a=rtcp-fb:100 nack
a=rtcp-fb:100 nack pli
a=rtcp-fb:100 goog-remb
a=setup:active
a=sendonly
a=rtcp-mux
a=ssrc:1818795736 cname:user2209928997@host-dbfe2687
a=ice-ufrag:aJGl
a=ice-pwd:AS3QOA1VPZHX51A2+otzRz
a=fingerprint:sha-256 3E:05:0F:75:E0:2B:3D:CD:1E:27:D2:FB:CA:C1:FD:C0:E5:38:77:A0:AA:FC:0E:A0:CF:33:DD:4D:BF:41:8A:CA


3. Then i used the following command 

ffmpeg -re -i ~/Desktop/Pesto.mp4 -vcodec copy -an -f rtp rtp://172.17.0.2:63832

Result: No media flowing 

all the statements below return false.
rtpEndpoint.isMediaFlowingIn(MediaType.VIDEO)  => false
rtpEndpoint.isMediaFlowingOut(MediaType.VIDEO) => false

webRtcEndpoint.isMediaFlowingIn(MediaType.VIDEO) => false
webRtcEndpoint.isMediaFlowingOut(MediaType.VIDEO) => false


Test 2: 

1. When i did the same as above again except instead of generating the rtpEndpoint offer i used the following (mangled) offer for the rtpEndpoint to process i.e. rtpEndpoint.processOffer(offer)

private static final String offer = "v=0\r\no=- 0 0 IN IP4 0.0.0.0\r\ns=\r\nc=IN IP4 0.0.0.0\r\nt=0 0\r\n"
        + "m=audio 5005 RTP/AVPF 96\r\na=rtpmap:96 opus/48000/2\r\na=sendonly\r\n"
+ "m=video 5000 RTP/AVPF 103\r\na=rtpmap:103 H264/90000\r\na=sendonly";


which gave me the following SDP answer 

 v=0
o=- 3686811366 3686811366 IN IP4 172.17.0.2
s=Kurento Media Server
c=IN IP4 172.17.0.2
t=0 0
m=audio 20710 RTP/AVPF 96
a=rtpmap:96 opus/48000/2
a=recvonly
a=ssrc:2692670894 cname:user3917241798@host-e6ce4c83
m=video 39044 RTP/AVPF 103
a=rtpmap:103 H264/90000
a=recvonly
a=ssrc:3139486918 cname:user3917241798@host-e6ce4c83


2. run the follwing: ffmpeg -re -i ~/Desktop/Pesto.mp4 -vcodec copy -an -f rtp rtp://172.17.0.2:39044


Result: 
No media flowing 


rtpEndpoint.isMediaFlowingIn(MediaType.VIDEO) => false
rtpEndpoint.isMediaFlowingOut(MediaType.VIDEO) => true

webRtcEndpoint.isMediaFlowingIn(MediaType.VIDEO) => false
webRtcEndpoint.isMediaFlowingOut(MediaType.VIDEO) => false


Any ideas what im doing wrong? 


Kind Regards






On Saturday, October 29, 2016 at 6:48:11 PM UTC+1, igracia wrote:

Ivan Gracia



To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.

Blobby

unread,
Oct 30, 2016, 7:35:08 AM10/30/16
to kurento


On Saturday, October 29, 2016 at 6:48:11 PM UTC+1, igracia wrote:

Ivan Gracia



To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.

Ivan Gracia

unread,
Oct 31, 2016, 7:23:08 AM10/31/16
to Kurento Public
Can you make sure that ffmpeg is indeed sending traffic to that IP and port? You can check that with tcpdump.

Ivan Gracia



To unsubscribe from this group and stop receiving emails from it, send an email to kurento+unsubscribe@googlegroups.com.

To post to this group, send email to kur...@googlegroups.com.
Visit this group at https://groups.google.com/group/kurento.

uullah

unread,
Oct 31, 2016, 3:51:24 PM10/31/16
to kurento
I think i found the issue, the kurento box was missing the following plugin: openh264-gst-plugins-bad-1.5

now it can transcode from h264 -> VP8. Ive got it to work with a ip cam.

However, do you know the ffmpeg command to send a video file as h264 (baseline)? as ive read that is the only profile Kurento supports? 

Ivan Gracia



Ivan Gracia

unread,
Nov 1, 2016, 1:32:31 PM11/1/16
to Kurento Public
No clue, sorry. There's probably info in the list about that command. Otherwise, you'll need to check with the ffmpeg people.

Ivan Gracia



To unsubscribe from this group and stop receiving emails from it, send an email to kurento+unsubscribe@googlegroups.com.

To post to this group, send email to kur...@googlegroups.com.
Visit this group at https://groups.google.com/group/kurento.

changb...@gmail.com

unread,
Nov 18, 2016, 8:00:15 AM11/18/16
to kurento
if x264 lib support for your ffmpeg  ,maybe you can  use  ffmpeg  cmd with  the  paramter   -vcodec h264

在 2016年11月1日星期二 UTC+8上午3:51:24,uullah写道:
Reply all
Reply to author
Forward
0 new messages