

# Audio rendition groups for HLS
<a name="audio-renditions"></a>

In MediaLive, you can set up an HLS output group to include an audio rendition group. An audio rendition group is a set of audio encodes (for example, a set of languages) that is associated with a video. Audio rendition groups let the downstream client player select a video and then select from among several audio encodes that all apply to that video.

Each audio encode in an audio rendition group is called an *audio rendition* or an *audio variant* or an *audio variant stream*.

You can set up the HLS output group in one of these ways:
+ As a regular HLS output group, with video, audio (in a rendition group), and optional captions.

  The video might be associated with only one audio rendition group, or it might be associated with several. For example, the video might be associated with one group consisting of high-bitrate audio and another group consisting of low-bitrate audio.

  Or one audio rendition group might be associated with several videos. For example, the same audio rendition group might be associated with the high, medium, and low-bitrate video offerings.
+ As an audio-only rendition group.

  In this case, follow the steps in this procedure, but ignore steps for setting up video.

**Note**  
The information in this section assumes that you are familiar with the general steps for creating a channel, as described in [Creating a channel from scratch](creating-channel-scratch.md).   
The key fields in the console that relate to this feature are under the **HLS Settings** field on the **Output settings** section of the **HLS output group** section on the **Create channel** page. To review the step where you complete these fields, see [The procedure](creating-hls-output-group.md#hls-create-procedure). 

**Topics**
+ [

# About audio rendition groups
](ARGs-about.md)
+ [

# Creating an output with an audio rendition group
](ARG-create.md)
+ [

# Sample manifest
](sample-manifest.md)

# About audio rendition groups
<a name="ARGs-about"></a>

## Standards compliance
<a name="ARG-compliance"></a>

This MediaLive implementation of audio rendition groups is compliant with *HTTP Live Streaming draft-pantos-http-live-streaming-18* section 4.3.4.1.1. 

## Examples
<a name="ARG-examples"></a>

### Example 1
<a name="ARGs-example-1"></a>

The HLS output group consists of:
+ One video output.
+ Three audio outputs (perhaps English, French, Spanish) that all belong to the same audio rendition group.

![\[Diagram showing a box labeled "RIG 1" containing four smaller boxes: "Video 1" and three "Audio" boxes.\]](http://docs.aws.amazon.com/medialive/latest/ug/images/ARG_oneV_threeA.png)


### Example 2
<a name="ARG-example-2"></a>

The HLS output group consists of:
+ One *video high* output.
+ One *video medium* output.
+ One *video low* output.
+ Three audio outputs (English, French, Spanish) that all belong to the same audio rendition group.

![\[Diagram showing three video inputs connecting to a single audio group with three audio outputs.\]](http://docs.aws.amazon.com/medialive/latest/ug/images/ARG_threeV_threeA.png)


### Example 3
<a name="ARG-3"></a>

The HLS output group consists of:
+ One *video high* output.
+ One *video low* output.
+ Two audio outputs (English, French) that each use the AAC codec. These outputs both belong to the same audio rendition group, RG1. 
+ Two audio outputs (English, French) that each use the Dolby Digital codec. These outputs both belong to the same audio rendition group, RG2. 
+ The video high output is associated with both audio rendition groups.
+ The video low output is associated only with the RG1 audio rendition group.

![\[Diagram showing video inputs connected to AAC and Dolby audio group outputs.\]](http://docs.aws.amazon.com/medialive/latest/ug/images/ARG_twoV_twoA.png)


# Creating an output with an audio rendition group
<a name="ARG-create"></a>

This section describes how to create audio rendition groups in an HLS output group and how to associate those groups with the appropriate video outputs (if any). The encodes and associations that you create are the following:
+ If you want to include video in the output group, then for each video asset, you create one video output containing one video encode. The output can also contain embedded captions, but it can't include sidecar captions. The output can't contain audio encodes.
+ For each audio asset, you create one *audio-only* output containing one audio encode and no other encodes. 
+ You decide on an ID for each rendition group. The ID is a name that you decide on. For example *AAC audio group*.
+ To group several audio outputs into one rendition group, you assign the same *audio group ID * to each audio output. 
+ Finally, to associate the video output (if any) with the audio rendition group, you assign the *audio group ID *to that video output. 

**Topics**
+ [

# Identify the video and audio encodes
](ARG-step-create-mapping.md)
+ [

# Determine Defaults and Selection Rules
](ARG-step-defaults.md)
+ [

# Create the video outputs
](ARG-step-create-video.md)
+ [

# Create the audio outputs
](ARG-step-create-audio.md)
+ [

# Summary
](ARG-create-summary.md)

# Identify the video and audio encodes
<a name="ARG-step-create-mapping"></a>

You must plan the requirements for the audio rendition group. You must identify the video encodes that you want in the output group. You then decide on the individual audio encodes. Finally, you identify the audio rendition groups you want each encode to belong to.

**To identify and map the encodes**

1. Identify any video encodes that you require in the HLS output group. For example, one high-resolution encode and one low-resolution encode.

1. Identify the audio encodes that you require. For example, AAC in English and French, and Dolby Digital in English and French.

1. Decide how many audio renditions you require. Review the [rules](#ARG-rules) to ensure that you design a rendition group that is valid. 

1. Give a name to each video, audio, and audio rendition group. For example:
   + A video output named **high definition**.
   + A video output named **low definition**.
   + Audio English AAC named **AAC EN**.
   + Audio French AAC named **AAC FR**.
   + Audio English Dolby Digital named **DD EN**.
   + Audio French Dolby Digital named **DD FR**.
   + A rendition group named **AAC group** for AAC audio.
   + A rendition group named **DD group** for Dolby Digital audio.

1. Identify how you want the video to be associated with the audio rendition groups. For example:
   + Video **high definition** to be associated with **AAC group** and **DD group**.
   + Video **low definition** to be associated only with **AAC group**.

1. (Optional) For completeness in designing the output group, identify the captions that you require. 

![\[Diagram showing output group with AAC, Dolby, and WebVTT caption groups in English and French.\]](http://docs.aws.amazon.com/medialive/latest/ug/images/ARG_twoV_twoA_twoC.png)


## Rules for video and audio in rendition groups
<a name="ARG-rules"></a>
+ Both video and captions are optional.
+ A video encode can be associated with more than one rendition group. For example, *video high* can be associated with both *Dolby audio* and *AAC audio*. There is no need to create separate video encodes for each rendition group.  
![\[Diagram showing two rendition groups connected to a single video encode.\]](http://docs.aws.amazon.com/medialive/latest/ug/images/ARG_oneV_twoARG.png)
+ All the rendition groups associated with the same video must contain the same audio encodes. For example, if both the AAC group and the Dolby group are associated with the high definition video encode, both these groups must contain the same audio languages (perhaps English, French, and Spanish). 
+ An audio encode can belong to only one audio rendition group. 
+ An audio rendition group can be associated with more than one video. For example, the Dolby group can be associated with the high definition video encode and the low definition video encode. There is no need to create separate rendition groups for each video.  
![\[Diagram showing a rendition group connected to two separate video elements.\]](http://docs.aws.amazon.com/medialive/latest/ug/images/ARG_twoV_oneARG.png)

# Determine Defaults and Selection Rules
<a name="ARG-step-defaults"></a>

As the second part of planning the audio rendition group, you should identify the following:
+ The rendition (if any) that is the default.
+ How auto-selection will work for the non-default renditions. 

This information might be useful to the client player that is playing this media asset. 
+ If a client player is configured with an audio preference (for example, Spanish) and that preference is not available, the player can use this information to select an audio. 
+ Or if the client player is not configured with any audio preference, the client player can use this information to select an audio.



(If the preference that is configured in the client player is available, the player ignores this information and selects that preference.)

**To determine defaults and auto-selection behavior**
+ For each audio rendition in the rendition group, choose the behavior from the following table. Each audio can have a different value. 

  Each row in the following table describes a different behavior.    
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/medialive/latest/ug/ARG-step-defaults.html)

**Example 1**  
In this example you want to set up the audio rendition group so that the client player can auto-select any of the renditions. You also want a default audio in the rendition group in case the client player is not set up with a default.  
+ Set only one audio rendition to *Alternate Audio, Auto Select, Default*.
+ Set every other audio rendition to *Alternate Audio, Auto Select, Not Default*.
+ Optionally, if you have an audio rendition that plays when the bandwidth is so low that the video cannot be delivered, then set that audio rendition to *Audio-Only Variant Stream*.

**Example 2**  
In this example you want to set up the audio rendition group so that the client player can auto-select only specific renditions. You also want a default audio in the rendition group in case the client player is not set up with a default.  
+ Set only one audio rendition to *Alternate Audio, Auto Select, Default*.
+ Set some of the other renditions to *Alternate Audio, Auto Select, Not Default*.
+ Set some of the other renditions to *Alternate Audio, not Auto Select*.
+ Optionally, if you have an audio rendition that plays when the bandwidth is so low that the video cannot be delivered, then set that audio rendition to *Audio-Only Variant Stream*.

**Example 3**  
In this example you want to set up the audio rendition group so that the client player can auto-select any audio rendition it chooses. You don't want a default audio rendition in the rendition group, so the client player always auto-selects audio.  
+ Set every audio rendition to *Alternate Audio, Auto Select, Not Default*.
+ Optionally, if you have an audio rendition that plays when the bandwidth is so low that the video cannot be delivered, then set that audio rendition to *Audio-Only Variant Stream*.

# Create the video outputs
<a name="ARG-step-create-video"></a>

If you want to include video in the HLS output group, then follow this procedure for each video encode.

This procedure involves the following fields in the output section of the HLS output group the Channel page in the console:
+ **Output settings** – **HLS settings**
+ **Output settings** – **HLS settings** – **Audio rendition sets**

**To create the video outputs**

1.  In the **HLS output group**, in **HLS outputs**, choose **Add output**. Choose **Settings** to display the **Outputs **page for that output.

1. In the **Output** page, set up as follows:
   + In **Stream settings**, choose **Audio 1** and choose **Remove audio**. The output now contains only a video encode. In an output group that includes audio rendition groups, each video encode must each be in a video-only output.
   + Set up the rest of the stream settings as described in [Fields for the video, audio, and captions streams (encodes)](hls-streams-section.md).

1. Complete the **Output settings** section as follows:
   + For **HLS settings**, choose **Standard hls** or **Fmp4**, as appropriate.
   + For **Audio rendition sets**, enter the name of the audio renditions groups to associate with this video output. Don't worry that you haven't created this name yet. To associate the video output with more than one group, enter a comma-separated list. For example:

     **AAC group, DD group**

# Create the audio outputs
<a name="ARG-step-create-audio"></a>

Follow this procedure for each audio encode in the HLS output group.

This procedure involves the following fields in the output section of the HLS output group the Channel page in the console:
+ **Output settings** – **HLS settings**
+ **Output settings** – **HLS settings** –** Audio track type**
+ **Output settings** – **HLS settings** – **Audio group ID**
+ **Output settings** – **HLS settings** – **Segment type**

**To create each audio output**

1.  In the **HLS output group**, in **HLS outputs**, choose **Add output**. Choose **Settings** to display the **Outputs **page for that output.

1. In the **Output** page, set up as follows:
   + In **Stream settings**, choose **Video 1** and choose **Remove video**. The output now contains only an audio encode. In an output group that includes audio rendition groups, each audio encode must each be in its own output.
   + Set up the rest of the stream settings in the usual way.

1. Complete the **Output settings** section as follows:
   + For **HLS settings**, choose **Audio only hls**. More fields appear.
   + For **Audio track type**, choose the value you decided on for this audio encode when you [determined the default](ARG-step-defaults.md).
   + For **Audio group ID**, enter the name of the rendition group that you want this audio encode to belong to. For example, enter **AAC group**. One audio encode can belong to only one rendition group. 
   + For **Segment type**, choose **AAC**.

   Ignore **Audio only image**. This field does not apply to audio rendition groups.

# Summary
<a name="ARG-create-summary"></a>

After following these steps, you have the following outputs:
+ Two or more audio-only outputs. Each output belongs to the audio rendition group specified in **Audio Group ID**.
+ Optionally, one or more video outputs. Each output is associated through the audio rendition group or groups specified in **Audio Rendition Sets**.

# Sample manifest
<a name="sample-manifest"></a>

This section provides an example of the audio portion of the manifest that MediaLive produces when you set up an audio-only output. This sample manifest contains the following elements:
+ Two video outputs, as indicated by the presence of two `EXT-STREAM-IN`F lines (the last two lines in the example).
  + The first video output has a low bandwidth. As indicated by the `AUDIO` parameter, it is associated with *audio1*.
  + The second video output has a higher bandwidth. As indicated by the `AUDIO` parameter, it is associated with *audio2*.
+ Four audio outputs, as indicated by the presence of four `EXT-X-MEDIA` lines with `TYPE=AUDIO`. In each audio output, the values for the parameters come from the following fields in each audio output in the channel:
  + `Type` is always `Audio`.
  + `GROUP-ID` is from the **Audio Group ID** field in the **Output settings** section.
  + `LANGUAGE` is from the **Language Code** field in the **Stream settings** section.
  + `NAME` is from the **Stream Name** field in the **Stream settings** section.
  + `AUTOSELECT` and `DEFAULT` are from the **Alternate Audio Track Type** field in the **Output settings** section.
  + `URI` is from the **Destination** field in the output group. 

  For information on all these fields, see [Create the audio outputs](ARG-step-create-audio.md).
+ Two audio rendition groups. The audio renditions groups don't have their own lines in the manifest. Their existence is implied by the presence of `GROUP-ID` parameters in the audio lines. 
+ Two captions streams, as indicated by the presence of two `EXT-X-MEDIA` lines with `TYPE=SUBTITLES`. 

```
     
#EXTM3U
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="AAC group",LANGUAGE="eng",NAME="English",AUTOSELECT=YES,\ DEFAULT=YES,URI="eng1/aac-en.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="AAC group",LANGUAGE="fre",NAME="français",AUTOSELECT=YES,\ DEFAULT=NO,URI="fr1/aac-fr.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="DD group",LANGUAGE="eng",NAME="English",AUTOSELECT=YES,\ DEFAULT=YES,URI="eng2/dd-en.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="DD group",LANGUAGE="fr",NAME="français",AUTOSELECT=YES,\ DEFAULT=NO,URI="fr2/dd-fr.m3u8"
            
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",LANGUAGE="eng",NAME="English",
DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,URI="sub-en.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",LANGUAGE="fra",NAME="French",
DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,URI="sub-fr.m3u8"
            
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=195023,CODECS="avc1.42e00a,mp4a.40.2",AUDIO="AAC group"
lo/prog-index.m3u8,SUBTITLES="subs",URI="curling-hi.m3u8"
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=591680,CODECS="avc1.42e01e,mp4a.40.2",AUDIO="DD group"
hi/prog-index.m3u8,URI="curling-lo.m3u8"
```