Direkt zum Inhalt

How to set KVS-WebRTC as an input for MediaLive?

0

I'm using Kinesis Video Streams with WebRTC for a live streaming application and planning to add MediaLive -> S3 -> CloudFront workflow to it. I'm using the JS SDK for WebRTC but I can only see methods for MediaStore. Can I use WebRTC with MediaLive directly without using MediaStore? Thanks.

3 Antworten
1

Hi, To use Kinesis Video Streams with WebRTC as an input for MediaLive, follow these steps:

  • Using the AWS Management Console or the AWS SDK, create a signaling channel in Kinesis Video Streams with WebRTC. A signaling channel is a resource that allows programs to use signaling messages to discover, set up, control, and terminate a peer-to-peer connection.
  • Use the Kinesis Video Streams WebRTC SDKs to connect to the signaling channel as a master or a viewer. These are software libraries that you may download, install, and configure on your devices and application clients to enable your WebRTC-capable camera IoT devices to engage in low-latency peer-to-peer media streaming.
  • Ingest the media stream from the WebRTC peer into a Kinesis video stream using the Kinesis Video Streams Producer SDKs or the GStreamer plugin. These are software libraries for capturing, processing, and sending video and audio data via Kinesis Video Streams.
  • Assign a Kinesis video stream as the input source to a MediaLive channel. To build and configure a MediaLive channel, utilize the AWS Management Console or the AWS SDK. For the Kinesis video stream input, you must give the stream name, stream ARN, and AWS credentials.
  • Launch the MediaLive channel and keep an eye on the output stream. To start and terminate the MediaLive channel, utilize the AWS Management Console or the AWS SDK. You may also utilize CloudWatch metrics and alerts to monitor the channel's health and performance.

I hope this answer helped you with your question. 😊

beantwortet vor 3 Jahren

0

AWS MediaLive does not accept WebRTC as an input. Any Kinesis Video in WebRTC format will need to be converted to one of the following stream formats:

  • HLS Push or HLS Pull
  • RTMP/RTMPS
  • RTP

These conversions could be cumbersome.

An alternative may be to use the KVS WebRTC stream as an input to the Amazon Interactive Video Stream (IVS), via the Stages input, which uses WebRTC. Amazon IVS does provide a translation between the Stages inputs and an HLS stream. The HLS is offered as a real time stream. This HLS stream can also be recorded to S3.

https://aws.amazon.com/about-aws/whats-new/2023/03/amazon-ivs-multiple-hosts-live-streams/ https://docs.aws.amazon.com/ivs/latest/RealTimeUserGuide/getting-started-create-stage.html https://docs.aws.amazon.com/ivs/latest/LowLatencyUserGuide/record-to-s3.html

AWS

beantwortet vor 3 Jahren

0

Disclosure: I work at Ant Media. We make a self-hosted media server, so I have an interest here. The first half of this answer applies to whatever you end up using.

Short version: you cannot wire these two together, and the reason is not a missing SDK method.

MediaLive accepts RTMP push, RTMP pull, RTP push, HLS pull, MP4, MediaConnect, and SRT. WebRTC is not an input type, and KVS signalling channels are not an input type either. The JS SDK only gives you peer methods because that is all KVS WebRTC does: it brokers peer connections. There is no publishing endpoint sitting behind it for MediaLive to pull from.

So you need something in between that terminates the WebRTC session and re-emits a protocol MediaLive understands. Three ways to do it:

KVS WebRTC with media ingestion. joinStorageSession writes the peer stream into a KVS video stream. That gets you storage and HLS playback out of KVS, but it still does not give MediaLive an input, so this only helps if you can drop MediaLive. A bridge on EC2. GStreamer with webrtcbin, or Pion, terminating the WebRTC session and pushing RTMP into your MediaLive input. This works, and it is the most code. You now own a stateful process that has to stay up, and you have to handle reconnects yourself. A media server that ingests WebRTC and emits RTMP. Same shape as 2, but you are configuring rather than writing it.

Now the part worth more than the answer to the literal question.

If what you want at the end is HLS in S3 behind CloudFront, look hard at whether MediaLive and MediaPackage need to be in this chain at all. A media server that ingests WebRTC natively can write HLS segments directly, and you point CloudFront at them. That removes two managed services, their per-hour channel charges, and the protocol conversion step you came here to solve.

The reason people reach for MediaLive is usually transcoding to an ABR ladder. If you need a real ladder for scale, keep MediaLive and use option 2. If you need one quality level, or two, you probably do not.

One thing that bit people on the original architecture: KVS WebRTC bills per signalling channel and per minute of streaming, and at any volume it stops being the cheap option compared to an instance you run yourself. Price the whole chain, not just the ingest.

For a worked example of the WebRTC ingest side on EC2, including the security group rules that catch everyone the first time, this is the walkthrough we wrote: https://antmedia.io/whip-server-aws/

Thank you.

beantwortet vor 14 Tagen

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.