1. 程式人生 > >How to Send Live Video to AWS Elemental MediaStore

How to Send Live Video to AWS Elemental MediaStore

In this blog post, I’ll describe how to send live HLS streams to AWS Elemental MediaStore.

AWS Elemental MediaStore is an AWS storage service optimized for media. It gives you the performance, consistency, and low latency required to deliver live streaming video content. In this blog post I will show you how to setup a simple live video workflow that uses MediaStore as its origin.

MediaStore Console

Outline

  1. Create AWS Elemental MediaStore Container
    1. Create Container
    2. Setup a container policy on your new container
    3. Add an optional CORS policy if you want to play the stream via an HTML HLS or HTML Dash video player
  2. Setup AWS Elemental MediaLive
    1. Create a RTMP input for the MediaLive channel
    2. Create the MediaLive channel
  3. Use your phone, desktop, or camera to stream to MediaLive
    1. Use OBS to stream to MediaLive

Part 1: Create AWS Elemental MediaStore Container

Step 1: Create Container

MediaStore Container

From the AWS console search for AWS Elemental MediaStore. Click “Create Container” and choose a name for your MediaStore container. After the container is done creating, move to the next step.

Step 2: Setup a container policy

After creating a container, add the following policy that allows anybody to view your live stream. By updating this policy, you can lock down your live stream, and restrict access to it, but for simplicity in this example we are creating a policy so anyone can view the live stream.

After selecting the newly created container, click on the “Container Policy” button. Copy the following JSON container policy into the box labeled “your container policy,” and make sure to replace AWS_ACCOUNT_NUMBER and CONTAINER_NAME with the name of your container and your AWS account number (found on the top right of your AWS console).

Container Policy


{
	"Version":"2012-10-17",
	"Statement":[ 
		{
			"Sid":"PublicReadOverHttpOrHttps", 
			"Effect":"Allow", 
			"Principal":"*", 
			"Action":[ 
				"mediastore:GetObject", 
				"mediastore:DescribeObject" 
			], 
			"Resource":"arn:aws:mediastore:us-west-2:AWS_ACCOUNT_NUMBER:container/CONTAINER_NAME/*", 
			"Condition":{ 
				"Bool":{ 
					"aws:SecureTransport":[ 
						"true", 
						"false" 
					] 
				} 
			} 
		} 
	] 
}

Step 3: Optionally setup a CORS policy

CORS stands for Cross-Origin Resource Sharing. CORS policies are used to grant permission to access selected resources when the request is from a server at a different origin.

If you want to view your live stream on the HLS JS video player demo page you will need to add a CORS policy on your container. To do so, click the “Edit CORS policy” button. Without the CORS policy you can still view your live stream in desktop players such as VLC or Quicktime.

The CORS policy below allows all headers to pass through, and any origin to watch the video. If you wanted to tighten the security on your live stream you would replace “*” in the “AllowedOrigins” list with the domain name of the website on which you are showing the video.

CORS Policy


[  
   {  
      "AllowedHeaders":[  
         "*"
      ],
      "AllowedMethods":[  
         "GET"
      ],
      "AllowedOrigins":[  
         "*"
      ],
      "ExposeHeaders":[  
         "*"
      ],
      "MaxAgeSeconds":3000
   }
]

Part 2: Setup Live Encoder

For our live streaming needs, we will be using AWS Elemental MediaLive, which is a broadcast-grade live video processing service. It lets you create high-quality video streams for delivery to broadcast televisions and internet-connected multiscreen devices, like connected TVs, tablets, smart phones, and set-top boxes. I will describe how to use Open Broadcaster Solution (OBS) to send RTMP to AWS Elemental MediaLive and link to some other options.

MediaLive Console MediaLive Input

Step 1: Create an RTMP input

  • Search for AWS Elemental MediaLive in the AWS console
  • Click “Create Channel”
  • Click “Inputs” on the left side and create a new input. I called my input “RTMP_Input”

For push inputs, you will need to define an input security group. I used the default 0.0.0.0/0 security group. This will allow any IP address to send an RTMP stream to your channel. You can lock this down to your IP address for added security.

  • Next, created an application name for Destination A and Destination B. I chose “stream1” and “stream2”
  • Then for application instance, I put the names “a” and “b”
  • Lastly click the “create” button

MediaLive RTMP

Step 2: Create the AWS Elemental MediaLive Channel

  • Add a name for your MediaLive channel. (I named my “LiveChannel”.)

  • Under IAM role, choose “Create role from template” if you have not created a role before, or select the MediaLiveAccess role if you have already created it. This role will provide PUT access to your MediaStore container as well as the other permissions required for your MediaLive channel.

MediaLive Select Input

  • Under channel input choose your RTMP input from the drop-down box.

MediaLive Output template

  • You can customize your outputs, configuring video settings such as resolution, bitrate, and other encoding parameters, but for this example, I have used the “Live Event” Channel Template.
    For the next step, you will need your container’s data endpoint, which can be found when clicking on the container on the AWS Elemental MediaStore console page.
  • In the upper left click on the HD (HLS) tab under the output groups. You will see HLS group destination A and HLS group destination B. Type in the endpoint for your MediaStore container: “mediastoressl://container_data_endpoint/path/main” for each output. We will only be using output A in this example. (Each output needs to be a unique path.)
  • Now click the large orange “Create Channel” button.

Part 3: Stream RTMP to live encoder

There are many ways to send content to AWS Elemental MediaLive. I am going to step through how to use OBS, sending RTMP.

For instructions on how to send to MediaLive in other ways, there is a series of blog posts detailing other options:

Stream from OBS to AWS Elemental MediaLive

  • After opening OBS in the settings menu select “Custom Streaming Server” and use the “Input Destinations” from Step 2 of Part 2. This is the destination for the RTMP stream

OBS

  • After setting this up your OBS encoder, go back to the MediaLive channel that you created and click the orange “Start Stream” button
  • After the MediaLive channel changes from the Start to the Running state click “Start Streaming” in your OBS program

MediaStore-objects

  • You can now go to the MediaStore console page to check your container. You should have objects showing up in your container

To test your HLS live stream this is the URL to use to access it.

http://container_data_endpoint/livea/main.m3u8

Paste that link into VLC player’s network input or if you are on a Mac you can use Quicktime or paste it into the Safari URL bar.

For instructions on how to create an Amazon CloudFront endpoint that uses MediaStore as an origin, see this blog post.

In part 2 of this blog, I’ll describe how to send to MediaStore from other encoders, such as AWS Elemental Live, or any other encoder.

相關推薦

How to Send Live Video to AWS Elemental MediaStore

In this blog post, I’ll describe how to send live HLS streams to AWS Elemental MediaStore. AWS Elemental MediaStore is an AWS storage serv

How to send an object from one Android Activity to another using Intents?

在 Activity 之間傳遞引數的方法: If you’re just passing objects around then Parcelable was designed for this. It requires a little more effort to use than using J

How to send an SMS in Node.js via SMPP Gateway

How to send an SMS in Node.js via SMPP GatewayIntroductionSMPP (Short Message Peer-to-Peer) is a protocol used by the telecommunications industry. It excha

Send Feedback to AWS

To submit feedback on the AWS console The console for each AWS service includes a Feedback button in the bottom-left corner that all

How to Send Fanout Event Notifications

Now that you have created the topic with Amazon SNS, you will create Amazon SQS queues that will subscribe to the topic. When

Extend AWS DeepLens to Send SMS Notifications with AWS Lambda

AWS DeepLens is a deep learning enabled developer toolkit with a video camera. It enables you to develop machine learning skills using hands-on co

How to send messages between distributed applications

Amazon Web Services is Hiring. Amazon Web Services (AWS) is a dynamic, growing business unit within Amazon.com. We are currently hiring So

exchange 2013 error:5.7.1 Client does not have permissions to send as this sender

exchange2013 self權限看了幾個文章,都是寫的exchange2010的報錯,有點過時了,我寫下exchange2013遇到該問題的排查首先排除服務器的問題和用戶本地配置的問題。對比法:服務器是否有問題?其他賬戶是否有問題?本地環境下其他賬戶是否有問題?均排除,那麽問題就在賬號上了。查看該賬號在

微信企業號報agent only allow to send text

微信 企業號 報錯 {"errcode":60011,"errmsg":"no privilege to access\/modify contact\/party\/agent "} ,主要是沒有權限訪問或修改人員的信息等,研究後,其實只要將紅圈部分的通訊錄權限開通好,就可以了。{"errc

How to convert matrix to RDD[Vector] in spark

toarray kcon tex logs def supports iterator ati true The matrix is generated from SVD, and I am using the results from SVD to do clusteri

How to convert BigDecimal to Double in spring-data-mongodb framework

public 行存儲 沒有 err 自己 dbr tom odbc sim 問題描述:我們都知道對於涉及錢的數據必須使用BigDecimal類型進行存儲,今天在查詢mongo時仍然有精度問題,雖然我在代碼中使用了Big Decimal類型,但mongo中使用的是double

How to Convert OST to PST

https://www.edbmailsThe OST to PST converter software enables data recovery from the corrupted OST files into outlook personal files. This recovery softwar

How to write threats to validity?

link ability http extern nsh strong result validity cer Paper reference Threats to construct validity are concerned with the relationship

How to Fix “Failed to play test tone” error on Windows 7, 8 and 10

rem item route audio laptop imu right answer tom 轉自: https://appuals.com/how-to-fix-failed-to-play-test-tone-error-on-windows-7-8-and-10/

How to use GITHUB to do source control

GITHUB sourcecontrolhow to create repository how to create branch how to add the comment for every change what is the commit how to rollback how to sync th

How to upgrade vim to version 8 on CentOS 7

-o cloud version http mce root code compile rep 同學們好,現在很多vim重度使用者呢,追求把vim打造成一流的IDE,於是很多人想著把vim升級到8.0但是編譯安裝呢又很麻煩,現在就分享一下使用yum把vim從7.0升級到8.

Python to list users in AWS

sch div iam school .com name print cli tran code import boto3 c1=boto3.client(‘iam‘) #list_users will be a dict users=c1.list_users() #t

藍鯨平臺本地上傳大檔案ERR_CONNECTION_RESE報錯處理client intended to send too large body:,server: paas.blueking.com

[[email protected] etc]# pwd /data/bkce/etc [[email protected] etc]# vim nginx.conf [[email protected] nginx]# pw

2018/11/12 send a letter to send to my apologies to one of my theacher beacuse I were late

send 技術分享 總結 sum spa gin 補救措施 src end (1)全文的總結, 告訴老師這封信是做什麽的.The summary of the letter to tell teacher what you are going to tell him

How to use script to get all oracle EBS Form name and corres

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!