

# Fields for the output destination – sending to MediaPackage
<a name="hls-destinations-emp"></a>

When you [planned the output to MediaPackage](hls-choosing-hls-vs-emp.md), you might have decided to send the output by creating an HLS output group. (Or you might have decided to create a [MediaPackage output group](creating-mediapackage-output-group.md).)

You must design the destination path or paths for the output. You must then enter the different portions of the path into the appropriate fields on the console.

You can use an HLS output group to send to standard MediaPackage or toMediaPackage v2. The two versions use different protocols:
+ MediaPackage uses WebDAV.
+ MediaPackage v2 uses Basic PUT.

**Topics**
+ [Design the path for the output destination](hls-destinations-emp-design.md)
+ [Complete the fields on the console](hls-specify-destination-emp.md)
+ [Standard MediaPackage example](hls-example-mediapackage.md)
+ [MediaPackage v2 example](hls-example-mediapackage-v2.md)

# Design the path for the output destination
<a name="hls-destinations-emp-design"></a>

Perform this step if you haven't yet designed the full destination path or paths. If you've already designed the paths, go to [Complete the fields on the console](hls-specify-destination-emp.md).

**To design the path**

1. Collect the information you [previously obtained](origin-server-hls-emp.md) from the MediaPackage user:
   + The two URLs (input endpoints is the MediaPackage terminology) for the channel. See the information after this procedure. 
   + If you are using standard MediaPackage, obtain the user name and password. If you are using MediaPackage v2, you don't use user credentials.

1. You must design the portions of the destination paths that follow the URLs. 

**Topics**
+ [Collect the information for standard MediaPackage](hls-destinations-emp-info.md)
+ [Collect the information for MediaPackage v2](hls-destinations-emp-info-v2.md)
+ [The syntax for the paths for the outputs](hls-syntax-emp.md)
+ [Designing the nameModifier](hls-nameModifier-design-emp.md)
+ [Designing the segmentModifier](hls-segmentModifier-design-emp.md)

# Collect the information for standard MediaPackage
<a name="hls-destinations-emp-info"></a>

For standard MediaPackage, the two URLs for a channel look like these examples:

`6d2c.mediapackage.us-west-2.amazonaws.com/in/v2/9dj8/9dj8/channel` 

`6d2c.mediapackage.us-west-2.amazonaws.com/in/v2/9dj8/e333/channel`

Where:

`mediapackage` indicates that the input endpoints uses version 1 of the MediaPackage API

`channel` always appears at the end of the URL. It is the base filename for all the files for this destination. 

The two URLs are always identical except for the folder just before `channel`.

# Collect the information for MediaPackage v2
<a name="hls-destinations-emp-info-v2"></a>

For MediaPackage v2, the two URLs for a channel look like these examples:

`mz82o4-1.ingest.hnycui.mediapackagev2.us-west-2.amazonaws.com/in/v1/live-sports/1/curling/index`

`mz82o4-2.ingest.hnycui.mediapackagev2.us-west-2.amazonaws.com/in/v1/live-sports/2/curling/index`

Where: 


| Element | Description | 
| --- | --- | 
| mz82o4-1 and mz82o4-2 |  Indicate that the two endpoints are for a redundant channel in MediaPackage. The prefixes are always -1 and -2 | 
| mediapackagev2 | Indicates that the input endpoints uses version 2 of the MediaPackage API | 
| live-sports/1/curling and live-sports/2/curling | Folders for the redundant ingests. One folder always includes /1/, and the other folder always includes /2/  | 
| index | Always appears at the end of the URL. It is the base filename for all the files for this destination.  | 

# The syntax for the paths for the outputs
<a name="hls-syntax-emp"></a>

An HLS output always includes three categories of files: 

See the following sections.
+ The main manifest
+ The child manifests
+ The media files

The following table describes the parts that make up the destination paths for these three categories of files.

The destination paths for these three categories of files are identical up to and including the *baseFilename*, which means thatMediaLive sends all these categories of files to the same folder. The modifiers and file extensions are different for each category of file. When sending to MediaPackage, you must send all the files to the same folder. The downstream systems expect all the files to be together.


| File | Syntax of the path | Example | 
| --- | --- | --- | 
| Main manifest files |  protocol channelURL extension |  The path for output. Here is an example that uses MediaPackage v2 `https://mz82o4-2.ingest.hnycui.mediapackagev2.us-west-2.amazonaws.com/in/v1/live-sports/2/curling/index.m3u8`  | 
| Child manifest files | protocol channelURL nameModifier extension | Here is an example for the path for the child manifest for the high-resolution renditions of the curling output (in a destination that uses MediaPackage v2):`https://mz82o4-1.ingest.hnycui.mediapackagev2.us-west-2.amazonaws.com/in/v1/live-sports/1/curling/index-high.m3u8` | 
| Media files (segments) | protocol channelURL nameModifier optionalSegmentModifier counter extension | Here is an example for the path for the file for the 230th segment (in a destination that uses MediaPackage v2):https://mz82o4-1.ingest.hnycui.mediapackagev2.us-west-2.amazonaws.com/in/v1/live-sports/1/curling/index-high-00230.ts | 

These paths are constructed as follows:
+ The MediaPackage user should have provided you with the channel URLs. The URLs cover the portion of the path up to and including the baseFilename:
  + With standard MediaPackage, the baseFilename is always `channel`. 
  + With MediaPackage v2, the baseFilename is always `index`. 
+ You must specify the following:
  + The modifier
  + The segmentModifier

  See the sections that follow.
+ MediaLive inserts the underscore before the counter.
+ MediaLive generates the counter, which is always five digits starting at 00001.
+ MediaLive inserts the dot before the extension.
+ MediaLive selects the extension:
  + For manifest files – always` .m3u8`
  + For media files – .ts for files in a transport stream, or .mp4 for files in an fMP4 container 

# Designing the nameModifier
<a name="hls-nameModifier-design-emp"></a>

Design the `nameModifier` portions of the file name. The child manifests and media files include this modifier in their file names. 

This `nameModifier` distinguishes each output from the other, so it must be unique in each output. 
+ For an output that contains video (and possibly other streams), you typically describe the video. For example, if you have three renditions, you might use **-high**, **-medium** and **-low**. Or each modifier could accurately describe the resolution and the bitrate (**-1920x1080-5500kpbs**).
+ For an output that contains only audio or only captions, you typically describe the audio or captions. For example, **-aac** or **-webVTT**.

It’s a good idea to start the `nameModifier` with a delimiter, such as a hyphen, in order to separate the` baseFilename` from the `nameModifier`.

The `nameModifier` can include [data variables](variable-data-identifiers.md).

# Designing the segmentModifier
<a name="hls-segmentModifier-design-emp"></a>

Design the segmentModifiers portion of the destination path. The segmentModifier is optional, and if you include it, only the media file names include it. 

A typical use case for this modifier is to use a data variable to create a timestamp, to prevent segments overriding each other if the channel restarts. For example, assume that you include the timestamp **\$1t\$1-**. Segment 00001 might have the name `index-120028-00001`. If the output restarts a few minutes later (which causes the segment counter to restart), the new segment 00001 will have the name `index-120039-00001`. The new file won't overwrite the file for the original segment 00001. Some downstream systems might prefer this behavior.

# Complete the fields on the console
<a name="hls-specify-destination-emp"></a>

After you have designed the output names and destination paths, you can set up the HLS output group.

The following fields configure the location and names of the HLS media and manifest files (the destination).
+ **Output group – HLS group destination** section
+ **Output group – HLS settings – CDN** section
+ **Output group – Location – Directory structure **
+ **Output group – Location – Segments per subdirectory**
+ **HLS outputs – Output settings – Name modifier**
+ **HLS outputs – Output settings – Segment modifier**

**To set the destination**

1. Complete the **URL** fields in the **HLS group destinations** section. Specify two destinations if the channel is set up as a standard channel, or one destination if it is set up as a single-pipeline channel.     
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/medialive/latest/ug/hls-specify-destination-emp.html)

1. Enter the input user name. For the password (if applicable), enter the name of the password stored on the AWS Systems Manager Parameter Store. Don't enter the password itself. For more information, see [Requirements for AWS Systems Manager password parameters](requirements-for-EC2.md).

1. In the **CDN** settings section, choose the appropriate connection type:
   + To send to standard MediaPackage, choose `Hls webdav`.
   + To send to MediaPackage v2, choose `Basic PUT`.

1. If the downstream system gave you values to [configure the connection](origin-server-http.md), enter those values in the fields in the **CDN** settings section.

# Standard MediaPackage example
<a name="hls-example-mediapackage"></a>

This example shows how to set up the destination fields if the downstream system for the HLS output group is standard MediaPackage.

Assume that you want to stream the curling game and to create three outputs: high, medium, and low bitrate. 


| Field | Value | 
| --- | --- | 
| CDN settings in HLS settings section | hls webdav  | 
| URL in HLS group destination A section |  6d2c.mediapackage.us-west-2.amazonaws.com/in/v2/9dj8/9dj8/channel | 
| Credentials in HLS group destination A section | MediaPackage accepts only authenticated requests, so you must enter a user name and a password that is known to MediaPackage. For the password, enter the name of the password stored on the AWS Systems Manager Parameter Store. Don't enter the password itself. For more information, see [Requirements for AWS Systems Manager password parameters](requirements-for-EC2.md).  | 
| URL in HLS group destination B section |  6d2c.mediapackage.us-west-2.amazonaws.com/in/v2/9dj8/e333/channel | 
| Credentials in HLS group destination B section | Enter a user name and password for the URL for destination B. The credentials are probably the same for both URLs, but they might not be. | 
| Name modifier in HLS outputs section |  Choose **Add output** twice: two more **Output** lines are added to this section, for a total of three lines. In each line, enter a modifier: **-high**, **-medium**, and **-low**.  | 
| Directory Structure and Segments Per Subdirectory in Location section | MediaPackage doesn't use these fields, therefore leave them blank.  | 

As a result, files are created with the following names:
+ One main manifest: **channel.m3u8**
+ One child manifest for each output: **channel-high.m3u8**, **channel-medium.m3u8**, **channel-low.m3u8**
+ TS files for each output: 
  + **channel-high-00001.ts**, **channel-high-00002.ts**, **channel-high-00003.ts**, and so on
  + **channel-medium-00001.ts**, **channel-medium-00002.ts**, **channel-medium-00003.ts**, and so on 
  + **channel-low-00001.ts**, **channel-low-00002.ts**,** channel-low-00003.ts**, and so on

The files will be published to both URL inputs on MediaPackage.

# MediaPackage v2 example
<a name="hls-example-mediapackage-v2"></a>

This example shows how to set up the destination fields if the downstream system for the HLS output group is standard MediaPackage. 

Assume that you want to stream the curling game and to create three outputs: high, medium, and low bitrate. 


| Field | Value | 
| --- | --- | 
| CDN settings in HLS settings section |  **basic PUT**  | 
| URL in HLS group destination A section | mz82o4-1.ingest.hnycui.mediapackagev2.us-west-2.amazonaws.com/in/v1/live-sports/1/curling/index | 
| Credentials in HLS group destination A section | Leave blank. MediaPackage v2 doesn't use credentials to authenticate.  | 
| URL in HLS group destination B section | mz82o4-2.ingest.hnycui.mediapackagev2.us-west-2.amazonaws.com/in/v1/live-sports/2/curling/index. | 
| Credentials in HLS group destination B section | Leave blank. MediaPackage v2 doesn't use credentials to authenticate.  | 
| Name modifier in HLS outputs section |  Choose **Add output** twice: two more **Output** lines are added to this section, for a total of three lines. In each line, enter a modifier: **-high**, **-medium**, and **-low**.  | 
| Directory Structure and Segments Per Subdirectory in Location section | MediaPackage doesn't use these fields, therefore leave them blank.  | 

As a result, files are created with the following names:
+ One main manifest: **index.m3u8**
+ One child manifest for each output: **index-high.m3u8**, **index-medium.m3u8**, **index-low.m3u8**
+ TS files for each output: 
  + **index-high-00001.ts**, **index-high-00002.ts**, **index-high-00003.ts**, and so on
  + **index-medium-00001.ts**, **index-medium-00002.ts**, **index-medium-00003.ts**, and so on 
  + **index-low-00001.ts**, **index-low-00002.ts**,** index-low-00003.ts**, and so on

The files will be published to both URL inputs on MediaPackage.