

# Creating an RTMP output group
<a name="opg-rtmp"></a>

When you create a AWS Elemental MediaLive channel, you might want to include an RTMP output group. For information about the use cases for an RTMP output group, see [Containers, protocols, and downstream systems](outputs-supported-containers-downstream-systems.md).

**Topics**
+ [Organize encodes in an RTMP output group](design-rtmp-package.md)
+ [Coordinate with the downstream system](origin-server-rtmp.md)
+ [Create an RTMP output group](creating-rtmp-output-group.md)

# Organize encodes in an RTMP output group
<a name="design-rtmp-package"></a>

An RTMP output group can contain the following:
+ One or more outputs.

Each output can contain the following:
+ One video encode.
+ Zero or one audio encodes.
+ Zero or one captions encodes.

This diagram illustrates an RTMP output group that contains one output where the captions are embedded in the video encode.

![\[Diagram showing Output Group containing Output with Video and Captions embedded.\]](http://docs.aws.amazon.com/medialive/latest/ug/images/output1-non-abr-Ve-A.png)


This diagram illustrates an RTMP output group that contains one output with object-style captions. 

![\[Venn diagram showing three overlapping circles labeled V, A, and C.\]](http://docs.aws.amazon.com/medialive/latest/ug/images/output2-non-abr-VAC.png)


# Coordinate with the downstream system
<a name="origin-server-rtmp"></a>

You and the operator of the downstream system must agree about the destination for each output of the RTMP output group. 

An RTMP output group requires one set of destination addresses for each output. 

1. If the RTMP server is a social media site, the host of the site might have instructions that can supplement the following information. Obtain these instructions.

1. Decide if you need two destinations for the output: 
   + If the MediaLive channel is a [standard channel](plan-redundancy.md), you need two destinations.
   + If the MediaLive channel is a single-pipeline channel, you need one destination. 

1. Make sure that the RTMP operator sets up to expect MediaLive output at one or two inputs on the RTMP server, as appropriate.

1. Obtain the following information from the RTMP operator:
   + The protocol for MediaLive to use—RTMP or RTMPS.
   + The user name and password to access the downstream system, if the downstream system requires authenticated requests. Note that these user credentials relate to user authentication, not to the protocol. User authentication is about whether the downstream system will accept your request. The protocol is about whether the request is sent over a secure connection.
   + IP address.
   + Port number.
   + Application name. Also called *app name*.
   + Stream name. Also called *application instance* or *app instance* or *stream key*.

     The operator might give you the application name and stream name as separate pieces of data. Or they might give you a complete path in the format **string/string**. In this case, the first string is the application name and the second string is the stream name.

   Here is an example of the information that the operator will give you:

   `rtmp://203.0.113.28:80/xyz/ywq7b`

   `rtmp://203.0.113.17:80/xyz/ywq7b`

   Where `xyz` is the application name, and `ywq7b` is the stream name.

   In this example, the two URLs have different IP addresses but the same application name/stream name portion. Your RTMP server might follow a different rule. 

# Create an RTMP output group
<a name="creating-rtmp-output-group"></a>

When you [planned the workflow for your channel](identify-downstream-system.md), you might have determined that you want to include an RTMP output group.

1. On the **Create channel** page, under **Output groups**, choose **Add**. 

1. In the **Add output group** section, choose **RTMP**, and then choose **Confirm**. More sections appear: 
   + **RTMP settings** – This section contains fields for the [connection configuration](rtmp-connection.md), for [resiliency](rtmp-other.md), and for [captions](rtmp-other.md). 
   + **RTMP outputs** – This section shows the single output that is added by default. An RTMP output can contain only one output, so don't click **Add output**. 

1. In **RTMP outputs**, choose the **Settings** link to view the sections for the output:
   + **RTMP destination** – This section contains fields for the [output destination](rtmp-destinations.md). 
   + **Output settings** – This section contains fields for the [connection configuration](rtmp-connection.md). 
   + **Stream settings** – This section contains fields for the [output streams](rtmp-streams.md) (the video, audio, and captions).

1. (Optional) Enter names for the output group and the output:
   + In **RTMP settings**, for **Name**, enter a name for the output group. This name is internal to MediaLive; it doesn't appear in the output. For example, **Sports Game**.
   + In **RTMP output**, in **Output settings**, for **Output name**, enter a name for the output. This name is internal to MediaLive; it doesn't appear in the output.

1. To complete the other fields, see the topics listed after this procedure.

1. After you have finished setting up this output group and its single output, you can create another output group (of any type), if your plan requires it. Otherwise, go to [Save the channel](creating-a-channel-step9.md).

**Topics**
+ [Fields for the output destination](rtmp-destinations.md)
+ [Fields for the RTMP connection](rtmp-connection.md)
+ [Fields for the video, Audio, and captions streams (encodes)](rtmp-streams.md)
+ [Other fields](rtmp-other.md)

# Fields for the output destination
<a name="rtmp-destinations"></a>

The following fields configure the location and names of the RTMP output files (the destination).
+ **Output** – **RTMP destination** sections

**To specify the destination for the output**

1. When you [discussed your requirements](origin-server-rtmp.md) with the operator of the RTMP server, you should have obtained the following information:
   + The protocol for MediaLive to use—RTMP or RTMPS.
   + IP address.
   + Port number.
   + Application name. Also called *app name*.
   + Stream name. Also called *application instance* or *app instance* or *stream key*.

     The operator might give you the application name and stream name as separate pieces of data. Or they might give you a complete path in the format **string/string**. In this case, the first string is the application name and the second string is the stream name.
   + The user name and password to access the server, if the downstream system requires authenticated requests. 

   Here is an example of the information that the operator will give you:

   `rtmp://203.0.113.17:80/xyz/ywq7b`

   Where `xyz` is the application name, and `ywq7b` is the stream name.

1. Enter the different portions of the destination in the appropriate fields.     
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/medialive/latest/ug/rtmp-destinations.html)

1. Complete the **Credentials** section, if the server the downstream system provided you with a user name and password. 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). 

# Fields for the RTMP connection
<a name="rtmp-connection"></a>

The following fields configure the logic for reconnection attempts:
+ **RTMP settings** – **Authentication scheme**
+ **RTMP settings** – **Additional settings** – **Cache length**
+ **RTMP settings** – **Additional settings** – **Restart delay**
+ **RTMP settings** – **Additional settings** – **Cache full behavior**
+ **RTMP outputs** – **Output settings** – **Connection retry interval**
+ **RTMP outputs** – **Output settings** – **Num retries**
+ **RTMP outputs** – **Output settings** – **Additional settings** – **Certificate mode**

**To configure a secure (RTMPS) connection to the destination**

1. **Authentication Scheme** – Specify the type of scheme. Typically, choose **Common**. Choose **Akamai** only if instructed to do so by the downstream system. 

1. For **Certificate mode**, choose the option that is required by the downstream system. 

   If you connect over RTMP, MediaLive ignores both these fields.

**To configure for reconnection**

There are several fields that control how MediaLive behaves if the connection to the RTMP server seems to drop:
+ **Cache length** specifies how long to hold the output in memory, waiting for the RTMP server to respond.
+ When that time expires, **Cache full behavior** specifies whether to disconnect immediately or wait 5 minutes.
+ If MediaLive disconnects, then **Restart delay** specifies how long to wait before trying to reconnect.
+ When MediaLive tries to reconnect, **Connection retry interval** specifies how often to retry. **Num retries** specifies how many times to retry. When the retries expire, this output stops. The channel stops because the single output has lost its connection.

# Fields for the video, Audio, and captions streams (encodes)
<a name="rtmp-streams"></a>

The following fields relate to the encoding of the video, audio, and captions streams (encodes) in the output. 
+ **Stream settings** section

For information about creating encodes, see the following sections:
+ [Set up the video encode](creating-a-channel-step6.md)
+ [Set up the audio encodes](creating-a-channel-step7.md)
+  [Set up the captions encodes](creating-a-channel-step8.md)

# Other fields
<a name="rtmp-other"></a>

The following field relates to implementing resiliency in an RTMP output:
+ **RTMP settings** – **Input loss action** – For details about a field on the MediaLive console, choose the **Info** link next to the field. For more information, see [Handling loss of video input](feature-input-loss.md).

The following field relates to implementing captions in an RTMP output:
+ **RTMP settings** – **Caption data** – Complete this field only if at least one of your outputs includes captions with **embedded** as the source captions format and **RTMP CaptionInfo** as the output format. If there are no captions in any output, the value in this field is ignored.

  For detailed information about setting up for captions, see [Including captions in a channel](captions.md).