AWS for M&E Blog

How to delay live streaming using AWS Elemental MediaPackage

The ability to introduce a delay into live or real-time streaming video is a critical function for many content providers. There are several reasons a content provider might want to introduce a time lag to a live stream broadcast.

Time zone differences: Delaying a live stream can accommodate viewers in different time zones, serving those who may not be able to watch the live stream in real time.

Legal compliance and content rights: Delaying a live stream can help make sure that the streaming content complies with any legal or regulatory requirements. This helps when service providers have the rights to stream live events with a specific time delay.

Delayed live streaming can be used for a variety of purposes, including broadcasting live events, such as sports or concerts, and for streaming live news coverage. It can also be used for interactive live streaming, where viewers can interact with the content in near real-time, but with a slight delay for smooth and uninterrupted playback. Delayed live streaming can also be used for content moderation, editing, and to address technical issues, such as audio or video problems. Delaying a live stream allows for these issues to be fixed before the content is published.

In this blog post, we describe the step-by-step procedure for setting up AWS Elemental MediaLive for video processing and AWS Elemental MediaPackage for video distribution to generate a delayed live feed that can accommodate viewers in different time zones.

Architecture

Following is the schematic view of an end-to-end setup for delayed live streaming using MediaLive and MediaPackage services on Amazon Web Services (AWS).

High level architecture for Delayed live streaming.

  1. Perform RTP push-based live stream ingest using your preferred tools or software. In this blog post, we use VLC to ingest an RTP push feed to AWS Elemental MediaLive.
  2. MediaLive generates HLS output and pushes to MediaPackage.
  3. A MediaPackage channel can expose different origin endpoints for viewers in various time zones. In this post, we generate 3 origin endpoints: one for viewers in India, with a “0” second delay, which means the program base location is India.
  4. The second origin endpoint is for viewers in Paris, France, with a three hour and thirty minute delay from the current program in India.
  5. The third origin endpoint is for viewers in Dubai, with a one hour and thirty minute delay from the current program in India.

Steps

Step 1: Create a MediaPackage Channel

  1. Open the MediaPackage console at https://console.thinkwithwp.com/mediapackage/.
  2. In the navigation pane, under Live, choose Channels.
  3. On the Channels page, choose Create channel.
  4. For ID, type a name that describes the channel. The ID is the primary identifier for the channel, and must be unique for your account in the region. For example: timedelay-pkg-channelname or service name.
  5. For Description, enter any descriptive text that helps you to identify the channel. For example: “Timedelay MediaPackage channel”.
  6. For Input type, choose Apple HLS.
  7. Choose Create.

Create MediaPackage Channel configuration

Step 2: Record details of the MediaPackage channel

  1. Open the MediaPackage console at https://console.thinkwithwp.com/mediapackage/.
  2. In the navigation pane, under Live, choose Channels.
  3. Select the created MediaPackage channel. In this case “timedelay-pkg-channel”
  4. From the HLS ingest endpoint section in the Ingest/Origin pane, record the URL, Username, and password.

Listing Ingest/Origin Endpoints in MediaPackage channel

Step 3: Create MediaLive channel input – RTP push input

  1. Sign in to the AWS Management Console and open the MediaLive console at https://console.thinkwithwp.com/medialive/.
  2. In the navigation pane, choose Inputs.
  3. On the Inputs page, choose Create input.
  4. In the Input details section, for Input name, enter “RTP Push Input”.
  5. For Input type, choose RTP.
  6. In the Input security group section, choose Create.
  7. In the text box, enter the address as a CIDR block. Say 0.0.0.0\0 to allow all traffic.
  8. Choose Create input security group.
  9. Choose Create to create the input.

Create Input in MediaLive configuration

Security group configuration for MediaLive input.

Step 4: Create MediaLive channel from a template

  1. Open the MediaLive console at https://console.thinkwithwp.com/medialive/.
  2. In the navigation pane, choose Channels. On the Channels page, choose Create channel.
  3. Enter Channel Name, say “timedelay-ml-channelname or service name”
  4. For IAM role, select Use existing role and select the role listed. In the case of no existing role, please select Create role from template.

Channel and Input detail configuration.

  1. On the Create channel page, in the Channel and input details section, in the Channel template section, do one of the following:
    • To use a built-in template: For Template, from the Channel templates section of the drop-down list, choose Live event HLS template.
  2. You would see the output group for HLS is auto created with specific output settings.

Channel template and Channel class configuration.

  1. On the Create channel page, in the navigation pane, for Input attachments, choose Add.
  2. In Attach input, for InputRTP Push Input (the input that you created).

The Attachment name field is automatically populated with the name of the input itself. You can leave this name as is.

  1. Choose Confirm.

Attach the input to MediaLive channel.

  1. In HLS output destination, enter the URL captured in Step 2.
  2. In HLS output destination, credentials option, select Create parameter and enter the Username captured in Step 2 against Username Enter the Name of your choice and enter the Password captured in Step 2 in Password field.

HLS Group Destination configuration for MediaLive channel.

  1. Choose Create channel

Step 5: Create MediaPackage origin endpoints

  1. Open the MediaPackage console at https://console.thinkwithwp.com/mediapackage/.
  2. In the navigation pane, under Live, choose Channels.
  3. Select the created MediaPackage channel.
  4. On the details page for the channel, under Origin endpoints, choose Manage endpoints.
  5. We will create three origin endpoints for three time zones (IST, CEST, GST considering IST is the base timezone and time delay configured accordingly for other time zones GST and CEST.)
  6. Create the origin endpoint for IST
    • For ID, enter a name that describes the endpoint. The ID is the primary identifier for the endpoint and must be unique to your account in the AWS Region. Say “IST_EP”.
    • For Description, enter any descriptive text that helps you to identify the endpoint. Say “Origin endpoint for India”.
    • For Manifest name, enter a short string that will be appended to the end of the endpoint URL. The manifest name helps to create a unique path to this endpoint. Say “ind_ep_index”.
    • For Time delay, enter the duration (in seconds) to delay when content is available to players. For IST, set the duration as “0”.

Origin endpoint configuration in mediapackage channel

  1. Choose Add to add one more origin endpoint.
  2. Create origin endpoint for CEST:
    • For ID, enter a name that describes the endpoint. The ID is the primary identifier for the endpoint and must be unique to your account in the AWS Region. Say “CEST_EP”.
    • For Description, enter any descriptive text that helps you to identify the endpoint. Say “Origin endpoint for Paris/France”.
    • For Manifest name, enter a short string that will be appended to the end of the endpoint URL. The manifest name helps to create a unique path to this endpoint. Say “fra_ep_index”.
    • For Time delay, enter 12600 (in seconds) to delay and align the content with the CEST time zone.

Origin endpoint configuration in mediapackage channel

  1. Choose Add to add one more origin endpoint.
  2. Create origin endpoint for UAE:
    • For ID, enter a name that describes the endpoint. The ID is the primary identifier for the endpoint and must be unique to your account in the AWS Region. Say “UAE_EP”.
    • For Description, enter any descriptive text that helps you to identify the endpoint. Say “Origin endpoint for Dubai”.
    • For Manifest name, enter a short string that will be appended to the end of the endpoint URL. The manifest name helps to create a unique path to this endpoint. Say “ae_ep_index”.
    • For Time delay, enter 5400 (in seconds) to delay and align the content with the UAE time zone.

Origin endpoint configuration in mediapackage channel

  1. Choose Save

Listing all the origin endpoints in MediaPackage channel.

Step 6: Start MediaLive Channel

  1. Open the MediaLive console at https://console.thinkwithwp.com/medialive/.
  2. In the navigation pane, choose Channels, and then on the Channelspage, choose the channel that you want to start.
  3. Choose Start. The channel state changes to one of the following:
    • Starting
    • Running (encoding on the pipeline or pipelines)
  4. Choose the channel name. The details for the channel appear.

Step 7: Ingest to MediaLive

  1. Set up VLC as a contribution encoder using RTP push
  2. Open the VLC application and select File and then Convert/Stream.
  3. Drag and drop the video you would like to ingest.
  4. Select Stream from Choose Destination
  5. Select Setup Steaming… option
  6. Select RTP against stream destination Type
  7. Enter the RTP Address and Port created in Step 3
  8. Select Apply, to start contribution using VLC

Step 8: Preview all the origin endpoints

  1. Open the MediaPackage console at https://console.thinkwithwp.com/mediapackage/.
  2. In the navigation pane, under Live, choose Channels.
  3. Select the created MediaPackage channel.
  4. On the details page for the channel, under Manage endpoints, select the Preview against each origin endpoint to view the live stream in a delayed fashion.

Listing all the origin endpoints in Mediapackage channel.

Step 9: Clean up

Remember to stop the MediaLive streaming channel when you are not using it. This stops the channel from incurring costs when inactive. To delete the channel permanently, stop and delete the MediaLive channel and its associated inputs, then delete the MediaPackage channel as well.

Learn more

AWS provides a number of services designed to assist in the building of media-related workflows. Explore additional applications for video streaming, processing, and delivery using AWS Media Services.

Yash Goel

Yash Goel

Yash Goel is an Enterprise Solutions Architect at AWS.

Deepak Das

Deepak Das

Deepak Das is a Sr. Edge Services Specialist SA at AWS working with customers in India & SAARC region to build and optimize media workflows in the cloud using AWS Elemental Media Services.

Maheshwaran G

Maheshwaran G

Maheshwaran G is a Specialist Solution Architect working with Media and Entertainment supporting Media companies in India to accelerate growth in an innovative fashion leveraging the power of cloud technologies. He is passionate about innovation and currently holds 8 USPTO and 7 IPO granted patents in diversified domains.