Any smart way to create HLS ?

796 views
Skip to first unread message

yarek chmielewski

unread,
Jul 9, 2018, 5:28:01 AM7/9/18
to meetecho-janus
What would be the "smart" way to create some HLS from en existing webrtc peer ?

Something like that (with use of another server to avoid killing Janus server CPU) ?

Janus server<---- relays RTP or webrtc (how to do that ?) -----> another server <------ transcodes to HLS using ffmpeg ?-----> .m3u8

Regards

Lorenzo Miniero

unread,
Jul 9, 2018, 5:30:19 AM7/9/18
to meetecho-janus
Check this talk here, the RTP forwarding part in particular:


L.

yarek chmielewski

unread,
Jul 9, 2018, 5:41:35 AM7/9/18
to meetecho-janus
Ok. watched your conf and got that you need to relay the RTP.

Any snippet  available ?

Regards

Lorenzo Miniero

unread,
Jul 9, 2018, 5:43:51 AM7/9/18
to meetecho-janus
I think there are a ton, if you use the search feature on the forum here. It's been discussed quite extensively in the past.

L.

yarek chmielewski

unread,
Jul 9, 2018, 6:04:01 AM7/9/18
to meetecho-janus
I found that : 


An interesting feature VideoRoom publisher can take advantage of is RTP forwarding. In fact, while the main purpose of this plugin is getting media from WebRTC sources (publishers) and relaying it to WebRTC destinations (subscribers), there are actually several use cases and scenarios for making this media available to external, notnecessarily WebRTC-compliant, components. These components may benefit from having access to the RTP media sent by a publisher, e.g., for media processing, external recording, transcoding to other technologies via other applications, scalability purposes or whatever else makes sense in this context. This is made possible by a request called rtp_forward which, as the name suggests, simply forwards in real-time the media sent by a publisher via RTP (plain or encrypted) to a remote backend.



I know, you will yell at me and that's a stupid question: but.. can RTP be played in a html5 video element or should it be transcoded to HLS ?

Steve Hardt

unread,
Jul 9, 2018, 12:10:20 PM7/9/18
to meetecho-janus
Your setup will depend on how you want to implement your video rooms. I am using dynamic rooms so it is a bit more complicated. If your video room is a static room, then it is not that hard, you just need to call a script before you initiate the RTP Forwarding to setup the trans-coder and SDP file. 

I use ffmpeg to create the HLS play list and do the trans coding. Since I use dynamic rooms that are created on the fly, I send a command to my server that runs a script and creates the SDP based on video and audio codec, searches for open ports to pass back to client, and starts ffmpeg.

When the above call is returned to the client I initiate the RTP Forwarding using the ports that were returned from the ajax call.

I use both WebRTC 1 to many and fall back to HLS for devices/browsers that do not support WebRTC. I use html 5 video for playback. This issue here is that depending on the device the html 5 video may not play the HLS stream native so you will need to also have a player such as video.js with the HLS add-on to play the video.

yarek chmielewski

unread,
Aug 17, 2018, 10:13:15 AM8/17/18
to meetecho-janus
- How is then the CPU usage for ffmpeg ?
- How seconds of delay fo you have in HLS ?
Regards

Steve Hardt

unread,
Aug 17, 2018, 11:49:41 AM8/17/18
to meetecho-janus
Well cpu usage will depend on your processor(s) and the number of HLS variants you are creating so I cannot really answer that. Delays will depend on how you configure your HLS segments and lists and it varies a bit too depending on the device that is used for watching. I do live stuff so the faster the better but you loose efficiency as their are a lot more request made to the server. I got mine down between 8 seconds on average.  If you are not doing live then the delay does not realy matter as much and you can have large segment times and segment list which reduces the requests to the server.
Reply all
Reply to author
Forward
0 new messages