Forward Mediasoup RTP Transport to AWS Elemental Media Live

Hello,

Thank you for the awesome mediasoup library. I have been playing around with it the last couple of weeks and really appreciate the amount of documentation and examples.

I was wondering if anyone has created an RTP transport using the mediasoup library and forwarded that stream to a 3rd party service such as AWS Elemental Media live for one-to-many streaming.

Found this example: https://d1.awsstatic.com/awselemental/workflowexamples/Workflow3_Example_FFMPEG_RTP_to_MediaLive_and_MediaPackage.pdf and wanted to see if this were possible using mediasoup.

AWS Elemental MediaLive supports RTP (MPEG TS) ingest with H.264 and AAC codecs and that example shows this code for how to use FFMPEG to transcode a video/audio file for publishing in AWS Elemental Media Live:

ffmpeg -re -i <source_file> -c copy -map 0 -f rtp_mpegts -fec prompeg=l=5:d=20
rtp://<IP>:5000 

Would it be possible to forward mediasoup’s RTP transport to this service and transcode via FFMPEG on the fly?

I tried using the H.264 video codec and transcoding to AAC (because mediasoup’s audio codec is OPUS), and the RTP stream I created had choppy video.

These were my FFMPEG args:

    const commandArgs = [
      "-protocol_whitelist",
      "pipe,udp,rtp",
      "-fflags",
      "+genpts",
      "-f",
      "sdp",
      "-re",
      "-i",
      "pipe:0",
      "-vcodec",
      "copy",
      "acodec",
      "aac",
      "-f",
      "rtp_mpegts",
      "-fec",
      "prompeg=l=5:d=20",
      "rtp://127.0.0.1:5000"
    ];

I realize my post is not tied to support for the mediasoup library, my apologies if it does not belong here, but I wasn’t sure where else to post it and was curious if anyone else has tried this workflow. Thanks.

mediasoup audio codec is not “just” OPUS. It supports tons of them:

Anyway, since you want to use WebRTC clients, you need mediasoup to use OPUS or any other audio codec supported by browsers (AAC is not).

Regarding your question: I don’t know what to say. You can forward plain RTP from mediasoup to other service. Such a service may transcode and then send it to a different service, etc. Cannot help much more since FFMpeg or Gstreamer is not my confort zone.

Thank you for your response. Sorry for the noobish nature to my question. This is new technical territory for me. I’ll look elsewhere for advice on transcoding the RTP stream. Thanks again for making this library available.

No problem at all. In order to transcode, the flow coming to my mind is:

  1. browser opus+h264 to mediasoup.
  2. mediasoup via plain RTP transport(s) to a FFMpeg or GStreamer process(es).
  3. Make FFMpeg or GStreamer send transcoded media to the external service via RTP.