Skip to main content

Streaming Video with Amazon S3, CloudFront, and Elastic Transcoder

Hands-On Lab

 

Photo of Craig Arcuri

Craig Arcuri

AWS Training Architect II in Content

Length

01:00:00

Difficulty

Advanced

In this hands-on lab, we will learn how to transcode a video file to a different video file format using AWS Elastic Transcoder. A common use case is to transcode a .mov file to an .mp4 file because typically .mp4 files are much smaller in size and more practical for users to view over the internet. In this lab, we are going to transcode an .mp4 file to a different resolution .mp4 file to allow students with slower internet speeds to complete the lab. We will create input and output S3 buckets and then upload the provided video file (included in the instructions for this lab). We will then create a CloudFront distribution, which will stream the output file to an HTML page. Finally, we will create an AWS Elastic Transcoder pipeline that will transcode the input file and send it to the output S# file. The CloudFront distribution can then stream the output file to an HTML page.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Streaming Video with Amazon S3, CloudFront, and Elastic Transcoder

Introduction

In this hands-on lab, we will learn how to transcode a video file to a different file format using AWS Elastic Transcoder. With video streaming, it is often necessary to transcode .mov files to .mp4 files because .mp4 files are typically smaller and more practical for users to view on the internet. In this lab, we are going to transcode an .mp4 file to a different resolution to enable users with slower internet speeds to view the video.

To accomplish this, we will do the following:

  • Create input and output S3 buckets to store our video files
  • Upload a video file to the input bucket
  • Create a CloudFront distribution that will stream the output file to an HTML page
  • Create an AWS Elastic Transcoder pipeline that will transcode the input file, send it to the output S3 file, and stream the output file to an HTML page

Log in to the AWS Management Console using the credentials provided on the lab instructions page.

Make sure you are using the us-east-1 region.

Create Two S3 Buckets

Create the Input Bucket

  1. In the AWS Management Console, navigate to the S3 service.
  2. Click + Create bucket.
  3. Give the bucket a unique name that contains the word "input" (e.g., "transcoderinput928").
  4. Click Next three times, then Create bucket.

Create the Output Bucket

  1. On the Amazon S3 page, click + Create bucket.
  2. Give the bucket a unique name that contains the word "output" (e.g., "transcoderoutput929").
  3. Click Next three times, then Create bucket.

Add the .mp4 File to the Input Bucket

  1. Download the file provided in the lab instructions.
  2. In the S3 Management Console, click Upload.
  3. Click Add files.
  4. Select the small-test-video.mp4 file (most likely located in your Downloads folder).
  5. Click Next three times, then Upload.

Create a CloudFront Distribution

  1. Open the AWS Management Console in a new tab in your browser, and navigate to the CloudFront service.
  2. Click Create Distribution.
  3. Under the Web header, click Get Started.
  4. Click into the Origin Domain Name field, and select the output bucket from the dropdown.
  5. Leave the rest of the default options as they are, and click Create Distribution.

Create the Elastic Transcoder Pipeline

  1. Open the AWS Management Console in a new tab in your browser, and navigate to the Elastic Transcoder service.
  2. Click Create a new Pipeline.
  3. Under the Create New Pipeline header, configure the following settings:
    • Pipeline Name: la-video-lab
    • Input Bucket: (Select your input bucket from the dropdown.)
    • IAM Role: (Select the pre-created role from the dropdown list.)
  4. Under the Configuration for Amazon S3 Bucket for Transcoded Files and Playlists header, configure the following settings:
    • Bucket: (Select your output bucket from the dropdown.)
    • Storage Class: Reduced Redundancy
  5. Under the Configuration for Amazon S3 Bucket for Thumbnails header, configure the following settings:
    • Bucket: (Select your output bucket from the dropdown.)
    • Storage Class: Standard
  6. Click Create Pipeline.
  7. Click Create New Job.
  8. On the Create a New Transcoding Job page, configure the following settings:
    • Pipeline: la-video-lab
    • Input Key: small-test-video.mp4
    • Preset: System preset: Generic 480p 16:9
    • Output Key: small-test-video-480p.mp4
  9. Click Create New Job.
  10. Click Jobs in the left sidebar.
  11. For Pipeline ID, select la-video-lab from the dropdown.
  12. Click Search.
  13. Go back to your S3 Management Console browser tab, and verify that the input file is in the input bucket and that the output file is in the output bucket.
  14. Switch to your CloudFront Management Console browser tab.
  15. When the status of the distribution is deployed, select the distribution by clicking the checkbox on the left.
  16. Copy the domain name to your clipboard.
  17. Switch to your S3 Management Console tab.
  18. Open your output bucket, and click the small-test-video-480p.mp4 file to open it.
  19. Click Make public.
  20. In the address bar of your browser, paste the domain name you copied to your clipboard earlier.
  21. Type "small-test-video-480p.mp4" after the slash (/).
  22. Press Enter to load the page.
  23. The transcoded video should be displayed on the web page.

Conclusion

Congratulations, you've successfully completed this hands-on lab!