AWS Media Blog

Monetize audio-only content with AWS Elemental MediaTailor

Introduction

This how-to blog post discusses how to monetize audio-only content such as podcasts and radio/talk shows on AWS by preparing the source for streaming with AWS Elemental MediaConvert and using Amazon CloudFront as a content delivery network (CDN) to deliver the content securely and with low latency. AWS Elemental MediaTailor is then used for server-side ad insertion on the resulting audio-only content.

During content creation, most podcasters record their shows using an external recorder and a high quality, uncompressed format such as a .WAV file and then export the audio to a stereo .MP3 file for distribution. MediaConvert accepts both formats. For this how-to, we will use an .MP3 file that has already been converted from its uncompressed format.

MediaConvert will then convert this source file into HTTP Live Streaming (HLS) format. HLS creates adaptive bitrate files (the client device and server dynamically detect the internet speed of the user and adjust audio quality accordingly). HLS does this by chopping up audio into 10 second segments. For this use case, we only use one bitrate (128 kbps), but a common use case is three bitrates: 64 kbps, 128kbps, and 256kbps where the first and latter bitrates are outlier cases around audio quality. Note: MediaConvert also supports these input/output formats for audio-only conversions.

CloudFront distributes these HLS files so that end users get the best experience in terms of latency and also for security so that the Amazon Simple Storage Service (Amazon S3) bucket can continue to block public access to its contents.

MediaTailor will be used for ad insertion and supports Video Ad Serving Template (VAST) and Video Multiple Ad Playlist (VMAP) responses from ad decision servers. In this example, we will use a VAST response. For configuring a VAST response or for additional ad insertion information, view the documentation here.

How to prepare audio source content using AWS MediaConvert

Upload the audio source content to an Amazon S3 bucket and create a folder for MediaConvert HLS output. In this example, the source file is a 256 kbps .MP3 titled “PartyPromo” and the created folder is titled partypromo_hls (this contains the outputted HLS files from MediaConvert).

Within a S3 bucket, displaying the Objects tab. The objects shown are the source file and empty folder that will contain outputted HLS files from MediaConvert.

Figure 1: Objects within an Amazon S3 Bucket

Once the source file is uploaded to an Amazon S3 Bucket, convert that file to an HLS format for streaming. The settings selected are based off minimum Apple Podcast Audio Requirements: 128 kbps, 44.1 KHz stereo audio file. To do so, navigate to MediaConvert and then create a job.

AWS Elemental MediaConvert service page from within the AWS Console. A Get Started button shown that allows user to Create a job.

Figure 2: AWS Elemental MediaConvert service page

When the Create a job screen displays, enter the appropriate input/output information. Within the inputs section, for Input file URL, browse Amazon S3 and select your source file. You will also Remove video selector from Input section. Keep the rest of the default settings in the Inputs section.

Showing the Create job screen within AWS Elemental MediaConvert. Input 1 is selected from the left sidebar with Input file URL completed with S3 location of source file (s3://...PartyPromo.mp3)

Figure 3: AWS Elemental MediaConvert job input tab

In the Output groups section, you add a new Apple HLS output group.

Within Create job section - Add output group is displayed with output options (File group / Apple HLS, DASH ISO, Microsoft Smooth Streaming, CMAF). Apple HLS option is selected

After creating a new output group, set Custom group name and Destination (where your HLS files will be delivered).

In the sidebar, under Output Groups, Apple HLS - partypromo is selected. Apple HLS group settings is displayed with Custom group name field completed with source file name (partypromo) and Destination containing s3 folder location to host manifest files (s3://.../partypromo_hls/)

Figure 4: AWS Elemental MediaConvert job – Apple HLS group settings

Scroll down and expand the Advanced section. For Manifest duration format, select floating point.

The advanced section of the Apple HLS Output group is down. Manifest duration format is completed with Floating point. The rest of the settings are left with defaults.

Figure 5: AWS Elemental MediaConvert job output – advanced settings

Manifest duration format: By default, the manifest duration format is set to Integer, which allows viewers to play the asset with HLS players version 2 (EXT-X-VERSION) and later. Setting the manifest duration format to Floating point forces viewers to play the asset with HLS players version 3 and later (which is the minimum requirement for AWS MediaTailor).

Next, click on the output underneath the Apple HLS output group to modify its settings. For Name modifier, put the name of your source file and Segment modifier. It can be the bitrate, which is _128 in this example.

H.264, ACC, partypromo is selected. Output settings is displayed with Name modifier completed with "partypromo" and Segment modifier completed with "_128"

Figure 6: AWS Elemental MediaConvert job output settings

Under Encoding settings, click Remove video since this is an audio-only file.

Encoding settings is shown with Video being selected in the left sidebar. The screen shows Video options and a button to Remove Video on the right side of screen.

Figure 7: AWS Elemental MediaConvert encoding settings (video tab)

This changes the Output settings view. Under the Audio section, for Audio track type, select Audio-Only variant stream.

Under Output groups, "AAC, partypromo" is selected on the left sidebar. The Audio twistie is expanded and Audio track type is completed with Audio-only variant stream.

Figure 8: AWS Elemental MediaConvert job output (audio tab)

Under Encoding settings, for the Audio 1 output, select the appropriate Sample rate (Khz) and Bitrate (kbit/s), For this example, the requirements are to change the Sample rate to 44.1 (how the .mp3 was recorded) and the Bitrate to 128 (what is needed for the podcast output). Keep the default values for the rest of the settings.

Audio 1 is selected under Encoding settings. The Sample rate (kHz) field is completed with 44.1 and the Bitrate (kbit/s) field is completed with 128.0. The rest of the settings are left with their default values

Figure 9: AWS Elemental MediaConvert Encoding Settings (Audio Tab)

Before creating the job, click underneath Job Settings and select AWS integration. If you have already used MediaConvert for Service role control, you may see “Use an existing service role”. You can use this role if it has the appropriate Amazon S3 permissions for your input/output locations. If this role does not have the correct permissions, you will see a job failure and error message.

Under Job Settings in the left sidebar, AWS Integration is selected. For Service role control, Use an existing service role is selected. For Service role, the MediaConvert_Default_Role is selected.

Figure 10: AWS Elemental MediaConvert job settings (AWS integration tab)

If this is your first time using MediaConvert, you can create a new service role with either full permissions or limited permissions where you define the input/output locations for the source file and the output files. If you keep the default role name, MediaConvert will use the same role for future MediaConvert jobs. In this example, a new service role with limited permissions is created and renamed so it does not become the default role.

In the left sidebar, under Job Settings, AWS Integration is selected. Under Service role control, Create a new service role, full permission is selected. Under New Role name, MediaConvert_Default_Role was typed in the field.

Figure 11: AWS Elemental MediaConvert job service role creation

In the left bar, under Job settings, AWS Integration is selected. Under Service Role Control, Create a new service role, configure permission is selected. Under New Role Name, a custom role name is typed.

Figure 12: AWS Elemental MediaConvert job service role creation

Once you have a role created/selected, click the Create button on the bottom right of screen.

At the bottom of right of the job page, a Create button is shown.

Figure 13: AWS Elemental MediaConvert create job

This will submit the job and takes a few minutes to complete. In this example, the source file was 40 minutes long and took approximately 4 minutes to complete. If you refresh, you will see the status move from SUBMITTED to PROGRESSING to COMPLETE.

Figure 14: AWS Elemental MediaConvert job summary

Figure 14: AWS Elemental MediaConvert job summary

Upon completion of the MediaConvert job, the output files will be in the folder you selected during the job settings. It should contain many small files and one manifest file that ends with .m3u8.

Within S3 bucket, the contents of the Media HLS folder (previously created) is shown. It contains a .m3u8 file and several .aac files.

Figure 15: HLS files created From AWS Elemental MediaConvert job

Please note your manifest file name since this is how you will test that the source file was converted properly.

The .m3u8 file is clicked and the object details are shown in detail (AWS region, last modified, Size, type). The field to focus on is Object URL which starts with https and ends with .m3u8.

Figure 16: HLS Manifest File Additional Information

How to configure a CloudFront distribution for access to the manifest and streaming files

First, select CloudFront in the AWS Console and then click on Create distribution.

For the Origin domain, select the Amazon S3 bucket that contains the MediaConvert output files. Next, set the Origin path to the folder that contains the manifest files. Provide a Name for the origin.

The Create distribution screen within CloudFront is shown with a focus on the Origin. Origin domain is completed with s3 bucket location containing the HLS files. The Origin Path is completed with /partypromo_hls (name of the folder that contains the HLS files) and Name field is completed with partypromo (name of audio file)

Figure 17: Amazon CloudFront origin settings

For S3 bucket access, select Yes use OAI (bucket can restrict access to only CloudFront) and then create a new OAI (if you do not have an existing one for this location). Under Bucket policy, select Yes, update the bucket policy to have CloudFront do this automatically and allow read access to the OAI.

Under CloudFront Distribution settings, S3 bucket settings are shown, the radio button for Yes use OAI (bucket can restrict access to only CloudFront)

Figure 18: Configuring Amazon CloudFront S3 bucket access

The other settings can be kept as default or modified based on user preferences. Once you review the other settings, you can then click on Create distribution.

At the bottom of the page for CloudFront distribution, a Create distribution button is displayed.

Figure 19: Amazon CloudFront create distribution

The CloudFront distribution process takes a couple of minutes to complete.

CloudFront distribution overview page with details such as Distribution domain name, ARN and Last modified.

Figure 20: Amazon CloudFront Distribution Information

Once completed, you can test the manifest file that ends in .m3u8 by appending the name to the CloudFront distribution into a service like JWPlayer Steam Tester.

Your web URL to your audio-only content will be your CloudFront distribution with your file name appended. After ensuring the file is accessible through CloudFront, insert an ad using MediaTailor.

How to configure ad insertion using AWS Elemental MediaTailor

Within the AWS Console, go to AWS Elemental MediaTailor and then click on Create configuration.

AWS Elemental Media Tailor service page within the AWS Console which displays two buttons, Create Configuration underneath Ad insertion and Channel assembly underneath New source location.

Figure 21: AWS Elemental MediaTailor service page

For Name, provide an identifier of your choice. For Content source, include the CloudFront distribution that hosts the manifest files. For Ad decision server, use your own or this example from Google (It will insert a piano ad at the beginning of your source).

Required settings for MediaTailor configuration page. Fields include Name, Content source (which is filled in with the CloudFront distribution) and Ad decision server which is filled in with example from Google

Figure 22: AWS Elemental MediaTailor configuration required settings

Next, click on Create configuration.

The configuration of MediaTailor page is shown with Content & origin details selected. The field that are shown are Session initialization prefix, HLS playback profile, DASH playback profile under Playback endpoint prefixes. Under Origin & manifest settings, Video content source, DASH MPD location, DASH origin manifest type and Transcode profile name, Ad marker passthrough are shown.

Figure 23: AWS Elemental MediaTailor Content & origin details

To test that the ad configuration is successful, copy the HLS playback prefix and append the .m3u8 file name previously created from MediaConvert. You can this test in a service like JWPlayer Stream Tester

You will know you were successful in inserting an ad when you test your link and are able to hear the piano ad playing at the beginning for the first 10 seconds of your audio. If you use a different ad server, then success can be measured based off the ad server settings (for example, an ad insertion every 5 minutes).

Conclusion

In this blog post, you learned how to monetize audio-only content with AWS Elemental MediaTailor using ad insertion. We walked through the process of using AWS MediaConvert to prepare an audio-only file, Amazon CloudFront to create a streaming distribution, and AWS Elemental MediaTailor for ad insertion.

Further Reading

Using AWS Elemental MediaConvert to create outputs with only audio

Creating an Amazon CloudFront Distribution

Getting started with AWS Elemental MediaTailor ad insertion

Dexter Doyle

Dexter Doyle

Dexter is a solutions architect at Amazon Web Services.