

# Designing an MPTS workflow
<a name="container-design-mpts-workflow"></a>

This section describes how to design a standard MPTS, and how to augment that standard MPTS by including passthrough elements.

You can configure the MPTS to include multiple programs. 

You can configure the MPTS to generate the following SI/PSI tables:
+ PAT. Required if you want to create a compliant MPTS.
+ PMT for each program. Required if you want to create a compliant MPTS.
+ NIT. Always optional.
+ SDT. Always optional.
+ TDT. Always optional.

You can also configure the MPTS to pass through any SI/PSI tables that you pass in, both the tables the Elemental Statmux can generate, and those that it never generates.

**Topics**
+ [Creating a standard MPTS](mpts-design-step-channels.md)
+ [Including passthrough programs](mpts-passthrough-program.md)
+ [Passing through custom streams](mpts-passthrough-high-pids.md)
+ [Passing through SI/PSI tables](mpts-passthrough-PSI-pids.md)

# Creating a standard MPTS
<a name="mpts-design-step-channels"></a>

This section describes how to create a standard MPTS. A standard MPTS is one where each STPS programs comes from a channel that is run on an Elemental Live node in the cluster. The SPTS programs can be any mix of VBR and CBR programs. The MPTS is fixed bandwidth, but the programs can be a mix of VBR and CBR programs.

**Assumptions**

This section assumes the following:
+ You know how to create profiles and channels using AWS Elemental Conductor Live. 
+ You are familiar with the encoding features of AWS Elemental Live.
+ You are familiar with the purpose of SPTS and MPTS, and of muxing and statmuxing.
+ You are familiar with the structure of an SPTS and MPTS, and specifically with SI/PSI tables, with programs, and with handling of packets in the transport stream.

**Topics**
+ [Step 1: Create the profiles and SPTS channels](#mpts-design-channel)
+ [Step 2: Create the MPTS and add channels](#mpts-design-create)
+ [Handling by Elemental Statmux](#mpts-design-handling)

## Step 1: Create the profiles and SPTS channels
<a name="mpts-design-channel"></a>

You perform these steps in Conductor Live. You don't perform them on Elemental Live.

1. Design the profile for each SPTS channel. 
   + Identify the input or inputs. The SPTS channel can use any Elemental Live inputs.
   + Identify the features you want to enable. For example, ad avails via SCTE-35 and motion overlay. There are no special rules about features that can be enabled in an MPTS channel. The channel follows the same rules as a regular Live event.
   + Identify the outputs you want to create:
     + You must always include one UDP/TS output that you configure for the MPTS. This output is called an *MPTS output*.
     + You can also include other UDP/TS outputs, for delivery to a regular UDP server.
     + You can include any number of outputs of another type. For example, you can include an HLS output group in order to produce an ABR stack for an OTT workflow.
   + Identify fields in the profile that you must set up as profile parameters. For more information about profile parameters, see [Working with channel parameters in a profile](creating-a-profile-with-channel-parameters.md).

1. As part of the design of the *MPTS* output (in the UDP/TS output group), consider the following:
   + You must set up to include the SI/PSI tables that Elemental Statmux requires — the PAT and the PMT.
   + You can include or exclude the NIT, SDT, and TDT tables. In the MPTS, you have the opportunity to configure them again, for the entire MPTS.
   + You don't set the PIDs for the video, the audio, most captions, or the PCR. 
   + You can choose to include ancillary data such as SCTE 35 and Nielsen ID3 data. But in all cases, you don't set the PIDs.

   When Elemental Live creates the output, it creates a PMT that references all the included streams, and it creates a PAT. It creates other tables according to the channel instructions. 

1. Create the profile. For more information, see [Creating a profile from scratch](creating-a-profile-from-scratch.md).

1. Create the channels for all the profiles that you have created. Create the channel in the way that you create any channel using Conductor Live. You can create the channel [from scratch](creating-a-channel.md), or you can [duplicate](creating-a-channel-by-duplicating.md) an existing channel. 

**Rules**

The following rules apply to the Elemental Live profiles and channels:
+ Everything about the profile can be identical to a regular profile used by a non-SPTS channel, except for the outputs. The profile must include one UDP/TS output that is set up for MPTS.
+ The channel can produce a UDP/TS output group that produces two outputs, one that is a regular SPTS (not a statmux SPTS), and one that is a statmux output. You might create this TS output as a *monitoring output*. Creating this output doesn't add to the workload on the channel.  
![\[Diagram showing channel A output flow to UDP/TS group and Elemental Statmux node with MPTS.\]](http://docs.aws.amazon.com/elemental-cl3/latest/ug/images/Channel-multi-outputs.png)
+ The channel can include both statmux outputs and non-statmux outputs. These non-statmux outputs can be of any type, including other UDP/TS outputs (that go to other destinations).   
![\[Diagram showing channel A with HLS, Archive, and Statmux outputs, plus Elemental Statmux node.\]](http://docs.aws.amazon.com/elemental-cl3/latest/ug/images/Channel-several-outputs.png)

## Step 2: Create the MPTS and add channels
<a name="mpts-design-create"></a>

Create an MPTS. To create the MPTS, see [Creating a standard MPTS](setting-up-mpts-outputs.md). The MPTS appears in the list of MPTSes.

Then [add channels](step-d-add-channels-to-the-mpts-output.md) (SPTS programs) to the MPTS. Specify a channel that exists in the cluster. This channel only ever has one program, so there is no need to tell MPTS which program to extract. 

For each program you add, you can assign the following:
+ Data to use in the SI/PSI tables in the output MPTS.
+ PIDs to assign to this program in the output MPTS. 
+ The bitrate range for this program in the MPTS. 
+ Locations for the different types of communications that occur between the Elemental Live node and the Elemental Statmux node. 

For much of this information, if you don't specify values, Elemental Statmux automatically assigns values when you save the MPTS. Elemental Statmux ensures that valid PIDs are assigned throughout the MPTS.

## Handling by Elemental Statmux
<a name="mpts-design-handling"></a>

When Elemental Statmux ingests each SPTS program, it handles the data as follows:

It uses the PAT and PMT to extract all the streams from the program—the video, audio, and so on. 

It reads any of the optional tables, such as the SDT. 

It uses the extracted data to create one set of new tables for the MPTS. If a program didn't include an optional table (such as the SDT), Elemental Statmux uses the information that you might have specified directly in the MPTS. Elemental Statmux assigns the standard PIDs to the tables. 

Elemental Statmux assigns new numbers to program streams, in order to avoid conflict when two SPTS programs use the same PID for the same stream. Elemental Statmux provides fields where you can assign new numbers. But typically in a standard MPTS, you let Elemental Statmux automatically assign numbers.

Elemental Statmux also generates its own NULL packets, to pad the MPTS and ensure a constant bitrate.

# Including passthrough programs
<a name="mpts-passthrough-program"></a>

In any MPTS, you can include any number of *passthrough program*s. A passthrough program is a source program that doesn't come from an Elemental Live node that is in the Conductor Live cluster. The program could be either of the following:
+ An MPTS produced by another encoder. That MPTS could include one or more SPTSes. Elemental Statmux lets you extract only the SPTSes that you want.
+ An MPTS produced by an Elemental Live node that is not in the Conductor Live cluster. In this case, the MPTS is an output from a UPD/TS output group, where the MPTS Membership of the output hasn't been set up as remote.

**Setting up**

You include the program by setting it up in the MPTS as a *passthrough program*. These rules apply:
+ The source programs must be well-formed MPTSes. They must contain all the tables that Elemental Statmux expects, so that Elemental Statmux can process the program in the same way as it processes standard Elemental Live SPTSes.
+ The source programs must have CBR video streams. They can't have VBR streams. 

To include passthrough programs, design the workflow in the regular way. When you create the MPTS, add passthrough programs. For each program, you must specify the following information:
+ The location where the upstream system is sending the source program. Elemental Statmux listens for the stream at that location.
+ The specific program to extract from the source MPTS.
+ Data to use in the SI/PSI tables in the output MPTS.
+ PIDs to assign to this program in the output MPTS. 

For much of this information, if you don't specify values, Elemental Statmux automatically assigns values when you save the MPTS. Elemental Statmux ensures that valid PIDs are assigned throughout the MPTS.

For detailed instructions about adding a passthrough program, see [Including passthrough programs in an MPTS](crud-mpts-passthrough-programs.md).

**Handling by Elemental Statmux**

When the MPTS starts, Elemental Statmux connects to the source transport stream that you specified and extracts the program that you specified. 
+ Elemental Statmux uses the PAT and SDT to identify the PMT, then uses the PMT to identify the streams (the video, audio, and data). 
+ It then discards all the SI/PSI tables from the source.
+ It assigns new output PIDs to the streams. You could specify the output PIDs that you want Elemental Statmux to use, but that step is optional.
+ It restamps the PCR in each program as it inserts the packets.
+ It creates a new PMT for the program, and includes that PMT in the PAT and SDT for the MPTS.

# Passing through custom streams
<a name="mpts-passthrough-high-pids"></a>

You can passthrough any stream from a source TS to the output MPTS. You can pass through any number of streams. 

This section describes the procedure for passing through a stream whose PID isn't reserved for an SI/PSI table. For example, you might want to pass through a stream that isn't part of any program because your downstream system can use the data. 

If you want to pass through an SI/PSI table rather than a custom stream, see the next section.

**Setting up**

You include the stream by setting it up in the MPTS as a *passthrough stream*. The source of the stream can be any well-formed transport stream.

To include a passthrough stream, design the workflow in the regular way. When you create the MPTS, add the passthrough stream. You must specify the following information for the stream:
+ The location where the upstream system is sending the source transport stream. Elemental Statmux listens for the stream at that location.
+ The PID to assign to this stream in the output MPTS. 

For detailed instructions about passing through a stream, see [Including passthrough streams in an MPTS](crud-mpts-pasthrough-streams.md).

**Handling by Elemental Statmux**

When the MPTS starts, Elemental Statmux connects to the location where the upstream system is publishing the transport stream, and extracts the packets for the specified PID. 
+ Elemental Statmux ignores and discards any SI/PSI tables that are in the transport stream. It extracts only the specified stream.
+ Elemental Statmux includes the stream in the MPTS. 
+ Elemental Statmux doesn't include the stream PID in any of the SI/PSI tables for the MPTS.

# Passing through SI/PSI tables
<a name="mpts-passthrough-PSI-pids"></a>

You can pass through any stream from a source TS to the output MPTS. You can pass through any number of streams. 

This section describes the procedure for passing through one or more SI/PSI tables that have been created outside of Elemental Statmux. If you want to pass through a custom stream rather than an SI/PSI table, see the previous section.

You can pass through the following:
+ An SI/PSI table that Elemental Statmux doesn't implement. For example, an EIT. 
+ An SI/PSI table that Elemental Statmux does implement. For example, a PAT.

You include the table by setting it up in the MPTS as a *passthrough stream*. 

You can combine SI/PSI table passthrough with custom stream passthrough and program passthrough.

**Setting up**

You pass through one or more SI/PSI tables by setting it up in the MPTS as a *passthrough stream*. 

To include passthrough streams, follow these steps:
+ Design the MPTS workflow in the [regular way](setting-up-mpts-outputs.md).
+ When you create the MPTS, add the passthrough streams. 

  You must specify the following information for the stream:
  + The location where the upstream system is sending the source program. Elemental Statmux listens for the stream at that location.
  + The PID to assign to this stream in the output MPTS. 

  For detailed instructions about passing through a stream, see [Including passthrough streams in an MPTS](crud-mpts-pasthrough-streams.md).
+ You might want to suppress some or all of the tables that Elemental Statmux usually generates. 
  + You must suppress table generation for a specific table if you are also passing through that table. Elemental Statmux won't allow two tables with the same PID.
  + You can optionally suppress table generation even if you aren't passing through the table. For example, you can suppress the PAT, even if you aren't passing it through. The MPTS won't include a PAT.

  For detailed instructions about suppressing table generation, see [Advanced tab – Suppressing generation of SI/PSI tables](step-create-mpts-tab-advanced.md).

**Handling by Elemental Statmux**

When passing through this type of stream, Elemental Statmux reads the PID of a passthrough table, to ensure that it doesn't conflict with other PIDs. But it treats the contents as a *black box*. Elemental Statmux doesn't perform any validation on the contents. 

It is your responsibility to make sure that all the SI/PSI tables are acceptable to the downstream system. It is your responsibility to ensure that the SI/PSI tables correctly reference the program and stream PIDs.