WebRTC to rtsp/rtmp/hls

4,029 views
Skip to first unread message

gaurav mishra

unread,
Aug 30, 2015, 4:08:10 AM8/30/15
to kur...@googlegroups.com
Hi,
I am trying to build a broadcasting application in which there will be two types of viewers 
1) low latency (consuming from WebRTC endpoints )
2)High latency (consuming http video segments from a cdn).

For the second type of viewers i am trying to figure out is there a way to feed the stream from webrtc endpoint to a traditional/older streaming infrastructure  
ie   webRtc --> (something that can get me hls stream) -> cdn 

for the middle part i have tried wowza with rtpEndpoint 
( webRTC-->rtpEndpoint -->wowza ->cdn). But it involves a lot of manual steps and have not been able to figure out a way to do everything programatically. 

Are there any other approach i can take to achieve what i want. even if it involves other transcoding softwares (ffmpeg/gstreamer). basically is there a way to transform webRTC stream into rtsp or rtmp or hls stream?

Andrey Utkin

unread,
Aug 31, 2015, 2:50:40 AM8/31/15
to kurento
Hi,

We do streaming kurento webrtc endpoint to hls, but with Kurento 5.1. On Kurento side, webrtc inbound endpoint connected to two RTP outbound endpoints - for video and audio streams respectively.
Then create small script wich use GStreamer to listen from RTP endpoints (we use udpsrc) and transcode/mux/create HSL files. Important thing is to create correct SDP files (offers) to setup outbound RTP endpoints on kurento side. In our case they looks like:

"videoSdpOffer":"v=0\no=- 1440770100 1440770100 IN IP4 192.168.56.103\ns=handmade\nc=IN IP4 192.168.56.103\nm=video 50712 RTP/AVP 101\na=rtpmap:101 VP8/90000",
"audioSdpOffer":"v=0\no=- 1440770100 1440770100 IN IP4 192.168.56.103\ns=handmade\nc=IN IP4 192.168.56.103\nm=audio 58740 RTP/AVP 96\na=rtpmap:96 OPUS/48000/2"



воскресенье, 30 августа 2015 г., 11:08:10 UTC+3 пользователь gaurav mishra написал:

gaurav mishra

unread,
Aug 31, 2015, 6:40:29 AM8/31/15
to kur...@googlegroups.com
Thanks for the reply. 

I am now able to do the same thing using ffmpeg . ie created two sdp files one for audio and one for video and mux them into a single stream. 
Which brings another question --why do we need to create two sdp files and two rtp endpoint . i tried having both audio and video stream descriptions in same sdp file (also single rtpEndpoint ) but ffmpeg was throwing some errors while processing this sdp file and i was not able to get audio in final output.  




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

Mark Hassman

unread,
Aug 31, 2015, 7:27:15 PM8/31/15
to kur...@googlegroups.com
Note sure if this helps, but I'm running a similar chain.. webrtc -> kurento -> rtp -> ffmpeg -> hls.
I'm using only a single rtp sdp/endpoint per kurento pipeline. Here's a sample:
 
   var rtp_sdp = "v=0\n" +
    "o=- 3641290734 3641290734 IN IP4 1.1.1.1\n" +
    "s=nginx\n" +
    "c=IN IP4 1.1.1.1\n" +
    "t=0 0\n" +
    "m=audio 60820 RTP/AVP 0\n" +
    "a=rtpmap:0 PCMU/8000\n" +
    "a=recvonly\n" +
    "m=video 59618 RTP/AVP 101\n" +
    "a=rtpmap:101 H264/90000\n" +
    "a=recvonly\n";
(ip's have been changed for privacy, but the idea is the same.. change 1.1.1.1 to your ffmpeg listening ip and pass this type of sdp to kurento's rtp processoffer function)
 
Note: i've found if you setup kurento's rtp endpoint before webrtp is complete, kurento at times sends rtp data to the incorrect udp port - offset by one increment from the sdp... so, i now wait for media state changed event of connected. that seems to have prevented the issue.
 


From: kur...@googlegroups.com [mailto:kur...@googlegroups.com] On Behalf Of gaurav mishra
Sent: Monday, August 31, 2015 6:40 AM
To: kur...@googlegroups.com
Subject: Re: [kurento-public] Re: WebRTC to rtsp/rtmp/hls

Jakeooo

unread,
Oct 30, 2015, 8:59:13 AM10/30/15
to kurento, ma...@hassman.org
 webrtc -> rtp -> ffmpeg 



sdp file

root@ubuntu:/tmp# cat test.sdp
v=0
o=SerTest 0 0 IN IP4 0.0.0.0
s=-
c=IN IP4 0.0.0.0
t=0 0
m=video 30010 RTP/AVP 100
a=rtpmap:100 H264/90000
a=recvonly

----------------------------------------------------------------

I have got error like this 

root@ubuntu:/tmp# ffmpeg -i /tmp/test.sdp -g 5 -c copy -f flv rtmp://localhost/hls/test
ffmpeg version N-76045-g97be5d4 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
  configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libdcadec --enable-libfreetype --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvo-aacenc --enable-libvidstab
  libavutil      55.  4.100 / 55.  4.100
  libavcodec     57.  6.100 / 57.  6.100
  libavformat    57.  4.100 / 57.  4.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6. 11.100 /  6. 11.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.100 /  2.  0.100
  libpostproc    54.  0.100 / 54.  0.100
[h264 @ 0x3bb50c0] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x3bb50c0] decode_slice_header error
[h264 @ 0x3bb50c0] no frame!
[h264 @ 0x3bb50c0] non-existing PPS 0 referenced
    Last message repeated 1 times


Any hint for the issue is appreciated. 

Thanks!




在 2015年9月1日星期二 UTC+8上午7:27:15,Mark Hassman写道:
Reply all
Reply to author
Forward
0 new messages