

# Choosing your ABR streaming output groups
<a name="choosing-your-streaming-output-groups"></a>

To create media assets for people to stream to their devices, choose one or more of the adaptive bitrate (ABR) output groups: Apple HLS, DASH ISO, Microsoft Smooth Streaming, or CMAF. The type of output group determines which media players can play the files that MediaConvert creates from that output group.

**Note**  
When you set up CMAF, DASH ISO, or Microsoft Smooth Streaming output groups, make sure to set your fragment length correctly. For information about setting fragment length, see [Setting the fragment length for streaming outputs](setting-the-fragment-length.md).

The following table summarizes the relationships between output groups and media players.


| Media players | Use this output group | 
| --- | --- | 
| Apple devices, earlier than approximately 2013 | Apple HLS | 
| Apple devices, newer | CMAF | 
| Android devices, most smart TVs | CMAF or DASH ISO | 
| Microsoft devices | Microsoft Smooth Streaming | 

**Note**  
MediaConvert bills for each minute of transcoded output time, not per job. Therefore, when you add output groups to a job, it becomes more expensive.   
For example, a job with an Apple HLS package and a DASH ISO package costs twice as much as a job with only one of those packages. This is assuming that the transcoding settings are the same.

**To determine which output groups you need**

1. Decide which devices you want end viewers to be able to play the transcoded media asset on. If you want your asset to play on every possible device, include these output groups:
   + Apple HLS
   + DASH ISO or CMAF
   + Microsoft Smooth Streaming

1. Consider whether to use advanced encoding features. To deliver either of the following to Apple devices, you must also include a CMAF output group:
   + High-dynamic-range (HDR) video
   + H.265 (HEVC) encoded video

   If you include a CMAF output, you don't need to create a DASH ISO output because all the common DASH-compatible players are also CMAF-compatible. 
**Note**  
There are a few uncommon DASH players that explicitly require the video segmentation extension type .mp4. MediaConvert outputs CMAF video segments in the .cmfv format. To create output that is compatible with these players, include a DASH ISO output group in your job.

1. Consider cost trade-off.

   If you don't need to support players produced earlier than approximately 2013, and if you don't need to support the rare DASH players that require .mp4 video segments, you can include a single CMAF output group instead of both DASH ISO and Apple HLS. Creating a single CMAF package instead of separate DASH ISO and Apple HLS packages can also offer cost savings in your video storage and distribution. This is because you must store and distribute only one set of video and audio files.

# Setting the fragment length for streaming outputs
<a name="setting-the-fragment-length"></a>

For all ABR streaming output groups other than HLS (CMAF, DASH, and Microsoft Smooth Streaming), the value that you specify for **Fragment length** (`FragmentLength`) must work with the other output settings that you specify. If you set **Fragment length** incorrectly, when viewers watch the output video, their player might crash. This can happen because the player expects additional segments at the end of the video and requests segments that don't exist. 

**Fragment length** is constrained by your values for **Closed GOP cadence** (`GopClosedCadence`), **GOP size** (`GopSize`), and **Frame rate** (`FramerateNumerator`, `FramerateDenominator`). For information about finding these settings on the console and in your JSON job specification, see [Finding the settings related to fragment length](#finding-the-settings-related-to-fragment-length).

**Note**  
When you set your output **Frame rate** to **Follow source**, make sure that the frame rate of your input video file works with the value that you specify for the output **Fragment length**. The frame rate of your input video file functions as your output frame rate. 

**Topics**
+ [Rule for fragment length](#rule-for-fragment-length)
+ [Fragment length examples](#fragment-length-examples)
+ [Finding the settings related to fragment length](#finding-the-settings-related-to-fragment-length)

## Rule for fragment length
<a name="rule-for-fragment-length"></a>

Fragment length must be a whole number and must be a multiple of this value: **GOP size** x **Closed GOP cadence** ÷ **Frame rate**

## Fragment length examples
<a name="fragment-length-examples"></a>

**Example: Correct settings**  
Closed GOP cadence = 1

Frame rate = 30

GOP size = 60 frames

Fragment length = 2

**Example: Incorrect settings**  
Closed GOP Cadence = 1

Frame rate = 50

GOP size = 90 frames

Fragment length = 2

## Finding the settings related to fragment length
<a name="finding-the-settings-related-to-fragment-length"></a>

When you set **Fragment length**, check your values for **Closed GOP cadence**, **GOP size**, and **Frame rate**.

### Fragment length
<a name="fragment-length"></a>

You can set the fragment length using either the console or the JSON job specification. The **Fragment length** setting applies to an output group and affects every output in the group.

**To find the **Fragment length** setting (console)**

1. On the **Create job** page, in the **Job** pane on the left, under **Output groups**, choose the name of your CMAF, DASH ISO, or Microsoft Smooth Streaming output group.

1. In the group settings section on the right, find **Fragment length**. 

   The group settings section is titled **CMAF group settings**, **DASH ISO group settings**, or **MS Smooth group settings**.

**To find the **Fragment length** setting (JSON job specification)**
+ Find `FragmentLength` as a child of `OutputGroupSettings`, as in the following example.

  ```
  {
    "Settings": {
      ...
      "Inputs": [
        ...
      ],
      "OutputGroups": [
        {
          "Name": "DASH ISO",
          "OutputGroupSettings": {
            "Type": "DASH_ISO_GROUP_SETTINGS",
            "DashIsoGroupSettings": {
              "SegmentLength": 30,
              "FragmentLength": 2,
              "SegmentControl": "SINGLE_FILE",
              "HbbtvCompliance": "NONE"
            }
          },
  		...
  ```

### Closed GOP cadence, GOP size, and frame rate
<a name="closed-gop-cadence-gop-size-and-framerate"></a>

You can set **Closed GOP cadence**, **GOP size**, and **Frame rate** using either the console or the JSON job specification. These settings apply to each output individually. Make sure that the values that you set for each output in the output group work with the value that you specify for the output group's **Fragment length**.

**Note**  
Your ABR stack has multiple outputs. Make sure to set these values in each output.

**To find the encoding settings for an output (console)**

1. On the **Create job** page, in the **Job** pane on the left, under **Output groups**, choose the name of your output, such as **Output 1**, **Output 2**, and so on.

1. In the **Encoding settings** section, the **Video** tab is selected automatically. Find **Closed GOP cadence**, **GOP size**, and **Frame rate** on this tab.

**To find the encoding settings for an output (JSON job specification)**
+ 

Find `GopClosedCadence`, `GopSize`, `FramerateNumerator`, and `FramerateDenominator` as children of the codec settings, as in the following example. In this example, the codec is `H_264`, so the parent of the codec settings is `H264Settings`.

  ```
  {
    "Settings": {
      ...
      "Inputs": [
        ...
      ],
      "OutputGroups": [
        {
          "Name": "DASH ISO",
          ...
          },
          "Outputs": [
            {
              "VideoDescription": {
                ...
                "CodecSettings": {
                  "Codec": "H_264",
                  "H264Settings": {
                    "InterlaceMode": "PROGRESSIVE",
                    "NumberReferenceFrames": 3,
                    "Syntax": "DEFAULT",
                    "Softness": 0,
                    "GopClosedCadence": 1,
                    "GopSize": 60,
  				  ...
                    "FramerateNumerator": 60,
                    "FramerateDenominator": 1
                  }
                },
                ...
              },
  ```

# HLS player version support
<a name="hls-player-version-support"></a>

AWS Elemental MediaConvert automatically sets the player version metadata based on the features that you enable. Most HLS assets that you create with MediaConvert are compatible with HLS players version 2 and later.

This list shows the features that might require updated player support:

**Add I-frame only manifest**: HLS Output group > Output > Advanced > Add I-frame only manifest  
When you choose **Include**, viewers can play the asset with HLS players version 4 and later.  
When you choose **Exclude**, viewers can play the asset with HLS players version 2 and later.

**Audio track type**: HLS Output group > Output > Output settings > Advanced > Audio track type  
When you choose one of the **Alternate audio** options for any audio variants, viewers can play the asset with HLS players version 4 and later.  
When you choose **Audio-only variant stream** for **Audio track type**, or keep **Audio track type** unselected for all of your audio variants, viewers can play the asset with HLS players version 2 and later.

**DRM encryption method**: HLS output group > DRM encryption > Encryption method  
When you choose **SAMPLE-AES** for **DRM encryption**, **Encryption method**, viewers can play the asset with HLS players version 5 and later.  
When you choose any other value for **DRM encryption**, **Encryption method**, viewers can play the asset with HLS players version 2 and later.

**Descriptive video service flag**: HLS output group > Output (must be audio-only) > Output settings > Descriptive video service flag  
This setting is also available in CMAF output groups: CMAF output group > Output > CMAF container settings > Advanced > Descriptive video service flag  
To find this setting, your HLS or CMAF output must have only audio settings. In HLS outputs, you must remove the default **Video** tab.  
When you choose **Flag** for **Descriptive video service flag**, viewers can play the asset with HLS players version 5 and later.  
To create a compliant Apple HLS output: When you set **Descriptive video service flag** to **Flag**, you must also set **Audio track type** to **Alternative audio, auto select, default** or **Alternative audio, auto select, not default**.

**Manifest duration format**: HLS output group > Apple HLS group settings > Advanced > Manifest duration format   
When you set your manifest duration format to **Integer**, viewers can play the asset with HLS players version 2 and later.  
When you set your manifest duration format to **Floating point**, viewers can play the asset with HLS players version 3 and later.

**Segment control**: HLS output group > Apple HLS group settings > Segment control  
When you set segment control to **Single file**, viewers can play the asset with HLS players version 4 and later.  
When you set segment control to **Segmented files**, viewers can play the asset with HLS players version 2 and later.