AWS for M&E Blog

How to stream 4K, HDR live video to YouTube using AWS Elemental Live or AWS Elemental MediaLive via HLS ingest

YouTube supports HLS ingest for premium content that requires high-quality and high-resolution video via HLS endpoint. YouTube supports MPEG2 transport stream muxed video with H.264 and HEVC codec, up to 60 fps with closed GOP. Audio must be AAC codec and muxed in MPEG2 transport stream.

Customers can now use AWS Elemental Live appliance and AWS Elemental MediaLive to stream 4K, HDR live video to YouTube. Customers can use the following instructions to set up Elemental Live and MediaLive.

Send an Elemental Live video to YouTube

You can use Elemental Live to send live HLS video to YouTube.

1. Open Elemental Live’s web user interface, click Event Control, and click New Event button on the right.

2. In Name field, type your event name.

3. Configure your video input in Input 1 section.

4. In Output Groups section, click Apple HLS tab. The UI will change to Apple HLS configuration.

5. Copy and paste the following URL to the Destination text field, replace <Your_Stream_Key> with the stream key of your YouTube channel. Note the ‘&’ at the end of the URL is required.

https://a.upload.youtube.com/http_upload_hls_std/file/index?cid=<Your_Stream_Key>&copy=0&

6. Change Segment Length to 2 seconds, and select Basic Put in HTTP Push Dialect dropdown box.

7. Move along to New Output section, click Add Output button to the right to add a new output. You will see a new Output and a new Stream are created.

8. In the Outputs section, input “_1” as the Name Modifier.

9. Go to Streams section, and configure Stream 1. This is the encoding configuration for the encoder to output a 4K, HDR stream.

10. In Stream 1 configuration, select Video, input 3840×2160 in Resolution, select HEVC (H.265) in Video Codec dropdown.

11. Click Advanced to show more options.

12. Select 59.940 in Framerate, input 20000000 in Bitrate, input 2 in GOP Size, select seconds in Units, set 2 in B Frames, 1 in Closed GOP Cadence, and 1 in Reference Frames.

13. Select Transition Detection in Scene Change Detection, select Main10/main in Profile, Uncheck the Flicker AQ checkbox, select 0.5 in Density vs Quality.

 

14. Click Preprocessors to expand more options. Click Color Corrector to turn it on. Select Force HDR10 in Color Space Conversion. Input 0 in both MaxCLL and MaxFALL.

 

15. At last, click the Create button at the bottom, once the event is created, click Start button to start the live event.

Send an AWS Elemental MediaLive stream to YouTube

You can stream a live 4K HDR video from MediaLive to YouTube. There are lots of blog post and articles talking about how to use MediaLive to stream to YouTube, we are not going to repeat the steps here, instead, we focus on how to set up HLS output for a 4K, HDR live video.

For more instructions on how to use MediaLive to stream to social media, please refer to the following blog post:

Live streaming to Facebook and YouTube with AWS Elemental MediaLive – https://aws.amazon.com/blogs/publicsector/live-streaming-facebook-youtube-aws-elemental-medialive/

When streaming to YouTube using HLS ingest, which is required for 4K HDR video ingest, you need to create an HLS output group instead of RTMP output group.

1. Log into AWS Management Console, go to MediaLive, click Create channel to start.

2. In Channel and input details, find Channel class, and select SINGLE_PIPELINE.

3. In Output Groups, click Add button, select HLS, and click Confirm.

4. Select the newly created HLS group, use the following URL in HLS group destination A. Replace <Your_Stream_Key> with your YouTube channel’s stream key. Note, the ‘&’ at the end is required.

https://a.upload.youtube.com/http_upload_hls_std/file/index?cid=<Your_Stream_Key>&copy=0&

5. In HLS settings section, find CDN Settings, select HLS basic put from the dropdown menu.

6. Expand Manifest and Segments section, set Segment Length to 2.

7. Select Output 1, find Stream settings, Select Video, and input 3840 in Width, and 2160 in Height, select H265 in Codec Settings.

8. Expand Rate Control, input 20000000 in Bitrate.

9. Expand Frame Rate, input 60000 in Framerate Numerator, and 1001 in Framerate Denominator. This will give a frame rate of 59.94 fps.

10. Expand GOP Structure, input 2 in GOP Size, and select Seconds in GOP Size Units.

11. Expand Codec Details, select MAIN_10BIT in Profile, MAIN in Tier, and H265_LEVEL_AUTO in Level.

12. Expand Color Space, select HDR10 in Color Space Settings.

13. Select Audio 1 in Stream setting, select AAC in Codec Settings.

14. Now, you should be able to stream live video to your YouTube channel using MediaLive.

Conclusion

Customers can use Elemental Live hardware appliance or MediaLive to stream high quality, live 4K, HDR videos to YouTube.

To learn more about Elemental Live and AWS Media Services, refer to the following links and blog posts:

 

If you have questions, feedback, or would like to get involved in discussions with other community members, visit the AWS Developer Forums: Media Services.