How to Convert YouTube Video to MP3 using S3, SNS & AWS Elastic Transcoder?

Step 1: Sign Up for AWS (Pre-requisite)

Step 2: Create an Amazon S3 Bucket or Two, and Upload a Media File

Let’s start, by creating an Amazon S3 bucket in Mumbai Region and create two folders to store the input files(video) and output files(audio):

1.In the AWS Management Console,under Services->Click S3 under Storage->Click Create bucket->Click Create.

2.Create two folders named inputs and outputs for storing video as input files and audio as output files.

3.Upload a Video file in the input folder. (Here I am uploading one of my YouTube video, we can upload any video for demo purposes)

Step 3: Create SNS Notification

1.In the AWS Management console,under Services->Click Simple Notification Service under Application Integration->Click Get Started->Click Create Topic.

Create 2 Topics (One for Completion and One for Error)

Now we need to subscribe these SNS topics to get notifications to our mail id.

Before creating subscriptions, copy the ARN for the Topics which we created as we need it for Subscriptions.

Complete arn:aws:sns:ap-south-1:523780346477:Complete

Error arn:aws:sns:ap-south-1:523780346477:Error

1.In the left management pane, Click on Subscriptions->Enter values of Topic ARN ( ARN will be generated when we create Topics as shown in above screenshot) ->Select Email as Protocol->Enter the value of Endpoint i.e your gmail address or any email address.

Create another subscription like this for completion topic. When we created these two subscriptions we should be getting confirmation email for these subscriptions->Click on Confirm subscription.

Once you Click on Confirm subscription for both the emails, it will take you to the new page with below confirmation message.

Now when you Click on Subscriptions in the left management pane, you can see the confirmation like this:

Step 4: Create a Pipeline

1.In the AWS Management console,under Services->Click Elastic Transcoder under Media Services->Click Create a new Pipeline and enter the values->Click Create Pipeline.

Step 5: (Optional) Create a Preset

If we want to create customized preset, then we can go to Preset in the left navigation pane and create custom preset and select the same during the creation of job.

Step 6: Create a Job

In the left management pane, Click Jobs->Click Create New Job and Enter the values->Click Create New Job.

Select created pipeline from drop down and enter output key prefix (location of S3 output folder to save the audio).

Under Input Details,select the input file and under Output details select the preset in the format you want to transcode and then give the output name of the file in the output key.

Step 7: Monitor the Progress of Your Job

Once the Job is completed, we can go to S3 output folder to see the audio mp3 file.

We will also get mail confirmation that Amazon Elastic Transcoder has finished transcoding the job since we have enabled SNS Subscription for Complete Topic.

As we can see the file has been successfully transcoded to audio mp3 format. This is the process for transcoding the video file to audio mp3 file format.

We can also use AWS Lambda as a function to execute the code ,based on the events generated by S3 when any object gets uploaded to S3 .

©2019 by Raghavendra Kambhampati