How to best architect a live video streaming platform using MediaLive, MediaPackage, and CloudFront?

Hi there,

I am building a live video streaming platform (users can push video streams via RTMP). I have gone through the AWS Live Video Streaming solution guide (https://aws.amazon.com/solutions/live-streaming-on-aws/) and the CloudFormation template. I understand how inputs and channels work on MediaLive and I’m planning to use MediaPackage and CloudFront to distribute the video feed (HLS).

On my platform, when people create a new stream, I want to provide them with an RTMP URL and stream key (will be on MediaLive) to push their feed. Should I programmatically (via i.e. JS SDK) create a new input and channel for every user stream? And then should I create a new channel and endpoint for MediaPackage and CloudFront as well? Is this the best/recommended approach?

I understand that there is a minimal cost incurred by idle MediaLive inputs/channels (is there for MediaPackage as well?), and I know that I could start the MediaLive channels only when/as needed. However, I know that starting a channel takes time, and ideally, I would like my users to be able to start pushing video content right away after they set up their stream. How long does it take for a channel to start? And is there any event I can subscribe to (or create on SNS) to know when the channel is ready?

I can also see that there are specific quotas and limits (https://docs.aws.amazon.com/medialive/latest/ug/limits.html). In my case, I might need to have tens if not hundreds of channels (if I do need a channel for every user indeed). Can I just apply to lift the quotas, same way it works for SES for example?

Last but not least, I see that the params object for the MediaLive createChannel function (JS: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/MediaLive.html#createChannel-property) is quite extensive. Is there a shorter template I can use that contains the most important parameters?

Does my approach overall make sense or is there a better way (from an operational and cost perspective) to achieve what I have in mind?

Thanks in advance!

Is there any reason to build this all yourself? Several companies out there have already done this and make an api available to build your own streaming app. Mux.com has done everything you’ve listed and made it available in an API.

For that type of application, I don’t think MediaLive will quite work, if you have that many channels running simultaneously, at least. There is a soft limit of 5 channels that can coexist at a time. This can be raised, but surely not into the thousands range. If you did happen to get it raised that high the price would be astronomical, as in hundreds of thousands to millions per month if you left them running. I’m not sure the best way to support that ask, but I’d probably check down the route of building something on ECS or Fargate, maybe using nginx with an rtmp module, or maybe using ffmpeg. It sounds like a cool idea, but cost-wise I don’t think elemental is the best choice for ingesting from a large number content origins.

Media live / media package are best used for broadcasting applications. Normally a broadcaster manages couple channels. Having 1 channel 24/7 costs more than a 1000 bucks per month. The advantages are that you have the best encoding quality and features, such as ABR, JIT packaging, DRM etc.
In terms of costs, por ingesting multiple sources, take a look at kinesis video streams.
If that doesn’t work, probably, provisioning streaming servers could be a solution.

If you need that kind of elasticity I think you might need to roll your own solution or go with a third party. The speed at which medialive deploys is pretty punitive

Hey, i think your best starting point would be Amplify Video. I would take a look at this blog post and these sample projects and use that as your starting point. Amplify Video is a CLI tool which launches a streaming (live or vod) back end for you. You can see examples of how to incorporate the back end launched by the tool in the workshops published by aws. These workshops were at re:invent 2018 and 2019 :)!

https://aws.amazon.com/blogs/media/introducing_aws_amplify_video/

https://github.com/awslabs/amplify-video

https://github.com/awslabs/aws-amplify-unicorntrivia-workshop

https://github.com/awslabs/unicornflix

Very good point. I’ve been looking into some providers (Wowza, Dacast, Mux (as you mentioned)). I definitely don’t want to spend too much time/effort building the live streaming infrastructure, I would rather spend that time focusing on my core product. I just wanted to explore if AWS’ Media Solutions could work for my use case, as I thought it would be cheaper than a ready-made service like the ones mentioned above (or maybe not). Do you have personal experience with any of these services? Would you recommend any (other than Mux)? Thanks a million!

Thanks, indeed, you’re right, the more I look into it, it doesn’t sound like MediaLive is geared towards my use case. I could potentially build a custom made solution but this would take too much time/effort I assume. Thanks for your help, appreciate it!

Yes, I’ve been doing some reading on MediaLive’s speed, thanks a lot!

I see, thanks for your input, appreciate it!

Great, thanks for sharing this, I’ll check it out!

Yes, I’ve used both Wowza and Mux.

Wowza was a nightmare. Sure, it is great for handing 1 RMTP stream. But otherwise, it is very expensive and is not scalable unless you have tens of thousands of dollars. We were having thousands of viewers and many live streams at once. We actually had a nice system designed to where 1 Wowza server acted as a “master”, and then for each stream a new instance fired up that handled the transcoding for that stream. It added a great deal of flexibility, but still not enough and had too much overhead.

We switched to Mux and it has been the best thing ever. High quality, easy to integrate, and blows Wowza away. Low overhead. And their support is fantastic. We have a direct Slack line with their chief engineers.

Awesome, really happy to hear that, thanks for sharing your experience, much appreciated!

You may be able to also use AWS Kinesis Video Streams for your use case, although it is particularly cost effective where you have a small number of consumers/viewers of the video as it only supports HLS/WebRTC as standard streaming protocols. If you want an out-of-the-box solution for pushing from camera to AWS Kinesis Video Streams, you can take a look at KVstreamer, which handles automatic creation of the stream based on it’s application configuration, which sounds useful for your use case.