WebRTC to RTMP

5,043 views
Skip to first unread message

talh...@gmail.com

unread,
Dec 29, 2015, 4:50:34 AM12/29/15
to kurento
Is it possible to send WebRTC stream from WebRTCEndPoint to my RTMP server? I haven't found any documentation about this in kurento but according to this, it seems possible.

Do I have to write custom module for this?

Ivan Gracia

unread,
Dec 30, 2015, 6:30:30 AM12/30/15
to Kurento Public
Yes, it is possible. No need to create any external module. There are quite a number of posts about this in the list. Try this or this, or search for "wowza" or "webrtc rtp".

Cheers,

Ivan Gracia



On Tue, Dec 29, 2015 at 10:50 AM, <talh...@gmail.com> wrote:
Is it possible to send WebRTC stream from WebRTCEndPoint to my RTMP server? I haven't found any documentation about this in kurento but according to this, it seems possible.

Do I have to write custom module for this?

--
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.

talh...@gmail.com

unread,
Dec 30, 2015, 10:56:03 AM12/30/15
to kurento
Thanks for your reply? I am fairly new to WebRTC, Kurento and such things. So, according to my understanding, I have to do these using Node.js and Javascript

1: Create WebRTC endpoint in Kurento
2: Connect WebRTC client to kurento endpoint
3: Process WebRTC client SDP offer in KurentoWebRTC Endpoint to get SDP answer
4: Process SDP answer retrieved in step 4 in WebRTC client. (Now WebRTC should be completed)
5: Connect WebRTC endpoint to RTPEndpoint.
6: Somehow get RTP Endpoint Ip and port.
7: Run some bash file using node.js to get data from rtp://ip:port retrieved in step 6 and forward it to rtmp server.

Are these step correct? Am I missing something? Does RTP endpoint or FFMpeg need some SDP? Is there better way to connect ffmpeg with kurento without bash i.e ffmpeg using Kurento functions?

Ivan Gracia

unread,
Jan 13, 2016, 9:47:39 AM1/13/16
to Kurento Public
Number 6&7 are not exactly so. Please have a look at this post, so you now how to negotiate the RTP endpoint.

Ivan Gracia


Talha Ahmed

unread,
Jan 13, 2016, 9:55:00 AM1/13/16
to kurento
I have done that. I am able to see video through rtp endpoint using vlc. Now, I need to transcode rtp stream to H264 and AAC for my rtmp server, I tried ffmpeg, but it was giving a lot of errors for some reason and transcoded streams were in very low quality. I am now looking to do transcoding with gstreamer.

Ivan Gracia

unread,
Jan 13, 2016, 10:12:50 AM1/13/16
to Kurento Public
Isn't the video from the RTP already in H264? Did you specify something different in the SDP? You shouldn't need to do that if you set that in the SDP.


Ivan Gracia


Talha Ahmed

unread,
Jan 13, 2016, 10:16:04 AM1/13/16
to kurento
v=0
o
=- 0 0 IN IP4 x.x.x.x
s
=abc
c
=IN IP4 x.x.x.x
t
=0 0
m
=video 58788 RTP/AVP 100
a
=rtpmap:100 H264/90000
a
=recvonly
m
=audio 58789 RTP/AVP 96
a
=rtpmap:96 PCMU/8000
a
=recvonly

This is my SDP. Even if it is in H264 I still need to change bitrate and resolution on video. Or is there a way to do that from SDP also? Also, is there any way to prevent hard coding port?

Ivan Gracia

unread,
Jan 15, 2016, 5:23:52 AM1/15/16
to Kurento Public
To change resolution, you can use a capsfilter.

Instead of hardcoding the port, you can generate the SDPs on the fly. Just keep a pool of ports, and know which ones you have assigned and that should be fine.

Ivan Gracia


Talha Ahmed

unread,
Jan 15, 2016, 5:25:37 AM1/15/16
to kurento
Thanks. I will do that.

Talha Ahmed

unread,
Jan 15, 2016, 10:31:21 AM1/15/16
to kurento
I have managed to do everything except there is just a little problem. My RtpEndpoint negotiate with following sdp:

v=0
o
=- 0 0 IN IP4 192.168.1.6
s
=Qq8FY5sPB4HFS1X
c
=IN IP4 192.168.1.6
t
=0 0
m
=video 45414 RTP/AVP 100
a
=rtpmap:100 H264/90000
a
=recvonlym=audio 45415 RTP/AVP 96
a
=rtpmap:96 OPUS/48000/2
a
=recvonly

and I use following gstreamer pipeline to publish its video to my rtmp:

gst-launch-1.5 -v udpsrc port=45414 ! application/x-rtp,payload=100,encoding-name=H264 ! rtph264depay ! video/x-h264, framerate=30/1 ! h264parse ! avdec_h264 ! videoscale ! video/x-raw, width=854, height=480 ! queue ! videoconvert ! queue ! x264enc bitrate=1000 key-int-max=60 bframes=0 byte-stream=false aud=true tune=zerolatency ! h264parse ! video/x-h264,level=(string)4.1,profile=main ! queue ! flvmux streamable=true name=mux ! queue ! rtmpsink location=rtmpurl

but I am not able to send audio to rtmp. I am using following gstreamer pipeline for that, but I am getting "Received invalid RTP payload, dropping" from `rtpopusdepay`:

gst-launch-1.5 -v udpsrc port=45414 ! application/x-rtp,payload=100,encoding-name=H264 ! rtph264depay ! video/x-h264, framerate=30/1 ! h264parse ! avdec_h264 ! videoscale ! video/x-raw, width=854, height=480 ! queue ! videoconvert ! queue ! x264enc bitrate=1000 key-int-max=60 bframes=0 byte-stream=false aud=true tune=zerolatency ! h264parse ! video/x-h264,level=(string)4.1,profile=main ! queue ! mux. udpsrc port=45415 ! application/x-rtp,payload=96,encoding-name=OPUS,clock-rate=48000, channels=(int)2 ! rtpopusdepay ! opusparse ! opusdec ! queue ! voaacenc bitrate=128000 ! aacparse ! audio/mpeg,mpegversion=4,stream-format=raw ! queue ! flvmux streamable=true name=mux ! queue ! rtmpsink location=rtmpurl

however I am able to send audio from "audiotestsrc" and video from Kurento Rtp to RTMP with different pipeline. What is wrong with above pipeline?

On Friday, 15 January 2016 15:23:52 UTC+5, igracia wrote:
To change resolution, you can use a capsfilter.

Instead of hardcoding the port, you can generate the SDPs on the fly. Just keep a pool of ports, and know which ones you have assigned and that should be fine.

Ivan Gracia
-- 

Jose Antonio Santos Cadenas

unread,
Jan 20, 2016, 3:13:43 AM1/20/16
to kur...@googlegroups.com
Hi, maybe you are having problems because you are using consecutive ports and this is usually for rtp an rtcp. Rtp port is an even port and rtcp is the next odd port. Try using only even ports.

Talha Ahmed

unread,
Jan 20, 2016, 9:28:51 AM1/20/16
to kurento
Thanks. Setting ports to even fixed that issue.
Reply all
Reply to author
Forward
0 new messages