4

I'm trying to use Janus Media Server to relay WebRTC streams to a particular RTP host/port, from where ffmpeg can pick it up as an input and convert it further to an rtmp stream, which can then be used to broadcast to various social media platforms (such as, YouTube, Twitch, Facebook, etc.)

My inspiration for this has been the following blog - https://www.meetecho.com/blog/firefox-webrtc-youtube-kinda/

Specifically, I'm trying to replicate the following architecture -

architecture

And Janus, as per their documentation, has a very neat API for doing it -

{
    "request" : "rtp_forward",
    "room" : <unique numeric ID of the room the publisher is in>,
    "publisher_id" : <unique numeric ID of the publisher to relay externally>,
    "host" : "<host address to forward the RTP and data packets to>",
    "host_family" : "<ipv4|ipv6, if we need to resolve the host address to an IP; by default, whatever we get>",
    "audio_port" : <port to forward the audio RTP packets to>,
    "audio_ssrc" : <audio SSRC to use to use when streaming; optional>,
    "audio_pt" : <audio payload type to use when streaming; optional>,
    "audio_rtcp_port" : <port to contact to receive audio RTCP feedback from the recipient; optional, and currently unused for audio>,
    "video_port" : <port to forward the video RTP packets to>,
    "video_ssrc" : <video SSRC to use to use when streaming; optional>,
    "video_pt" : <video payload type to use when streaming; optional>,
    "video_rtcp_port" : <port to contact to receive video RTCP feedback from the recipient; optional>,
    "simulcast" : <true|false, set to true if the source is simulcast and you want the forwarder to act as a regular viewer (single stream being forwarded) or false otherwise (substreams forwarded separately); optional, default=false>,
    "video_port_2" : <if simulcasting and forwarding each substream, port to forward the video RTP packets from the second substream/layer to>,
    "video_ssrc_2" : <if simulcasting and forwarding each substream, video SSRC to use to use the second substream/layer; optional>,
    "video_pt_2" : <if simulcasting and forwarding each substream, video payload type to use the second substream/layer; optional>,
    "video_port_3" : <if simulcasting and forwarding each substream, port to forward the video RTP packets from the third substream/layer to>,
    "video_ssrc_3" : <if simulcasting and forwarding each substream, video SSRC to use to use the third substream/layer; optional>,
    "video_pt_3" : <if simulcasting and forwarding each substream, video payload type to use the third substream/layer; optional>,
    "data_port" : <port to forward the datachannel messages to>,
    "srtp_suite" : <length of authentication tag (32 or 80); optional>,
    "srtp_crypto" : "<key to use as crypto (base64 encoded key as in SDES); optional>"
}

For this, I've setup a Nginx server, where I've also installed Janus and everything's been running smoothly so far. But I'm quite clueless as to how to setup my Nginx server so that it accepts RTP connections (which will be forwarded as RTMP using ffmpeg).

Please guide me to any relevant resources that would help me achieve this. Thanks in advance!

Swap
  • 480
  • 2
  • 7
  • 21

0 Answers0