DASH and HLS Adaptive Streaming with AWS S3 and Cloudfront

Bitmovin integrates DASH and HLS adaptive streaming seamlessly into your AWS workflows. The Bitmovin encoding service could be configured to use an AWS S3 bucket as input and output for your DASH and HLS encoded videos. On top of that bucket you can configure AWS Cloudfront and enable DASH and HLS playback through the Bitmovin player to get the best possible experience. We will describe the basic steps to setup this workflow in the following.

Bitmovin Encoding and AWS

Basically you can follow our general getting started guide with the exception that you would use S3 also as an input. The first step is that you create or use and existing AWS S3 bucket and set the correct permissions so that we are allowed to access the videos on your bucket. The following permissions need to be set on the input bucket:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetObject"
            ],
            "Resource": [
                "arn:aws:s3:::YOUR_BUCKET_NAME/*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:ListBucket",
                "s3:GetBucketLocation"
            ],
            "Resource": [
                "arn:aws:s3:::YOUR_BUCKET_NAME"
            ]
        }
    ]
}

Now you can create an input (reference to an video) which can be used for encoding. Just navigate to the Create Input section and fill in the information so that we can access your video.

s3-input-video

For the next steps, i.e., Select Encoding Profile, Select Adaptive Streaming Formats, Start Encoding and Encoding you can follow the getting started guide. After your encoding has finished you can transfer it back to your S3 bucket into a separate folder or into another S3 bucket used just for the output. Before adding the output you need to enable at least the following permissions on the bucket that will be used as output:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetObject",
                "s3:PutObject",
                "s3:PutObjectAcl"
            ],
            "Resource": [
                "arn:aws:s3:::YOUR_BUCKET_NAME/*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:ListBucket",
                "s3:GetBucketLocation"
            ],
            "Resource": [
                "arn:aws:s3:::YOUR_BUCKET_NAME"
            ]
        }
    ]
}

FAQ: How do I create a AWS S3 Bucket which can be used as output location?

The next step is that you add your S3 bucket as Output to Bitmovin as shown below:

s3-output

Now you can transfer your encoded videos to this output bucket as described in the Get Started Guide – Transfer The Video To Your Output.

aws-s3-bitcodin-job

When the transfer finished you should see the encoded video output on your S3 bucket. The output consists of several folders that contain the individual video qualities (renditions/representations) and manifest files used for HLS and MPEG-DASH streaming.

AWS Setup for Adaptive Video Streaming

Setup CORS and crossdomain.xml on S3

Go to your Amazon S3 Bucket properties and enable Cross-Origin Resource Sharing (CORS), which is needed to stream your MPEG-DASH and HLS content to HTML5 enabled browsers.

s3-cors-setup

Bitmovin supports HTML5 based adaptive streaming on all major browsers but very old versions of these browsers sometimes do not allow HTML5 based playback. For that edge cases we implemented MPEG-DASH and HLS in Flash and our player will automatically fallback to Flash if needed to guarantee maximum device reach. Therefore, it makes sense to enable also Flash based streaming on your S3 bucket, which requires that you add an crossdomain.xml file in the root directory of your S3 bucket.

Attach CloudFront to your S3 Bucket

Just go to the Amazon Cloudfront menu and click on Create Distribution.

cloudfront-distribution

In the first step of the dialog you need to select the delivery method. For HTTP based adaptive streaming (MPEG-DASH and HLS) you need to select Web Distribution.

cloudfront-web-distribution

The second step already creates the distribution. You just need to configure the origin. Therefore, click on the Origin Domain Name field, AWS will list all your buckets, and select your output bucket that contains the encoded content. There are a lot of other details that can be configured, such as adding specific CNAMES, etc. but for a simple setup this is not needed. When finished click on Create Distribution and you are done.

cloudfront-domain-name

Afterwards you should see your CloudFront Distribution and the Domain Name of the distribution. You could now access all the content of your S3 bucket through this domain name.

Make sure that you use this domain name with the path that points to the manifest files (MPD and M3U8) when setting up the player. For the player setup you can follow our general Player Getting Started Guide.

Back to Top
Simple Share Buttons