

# Setting up input prepare actions in the schedule
Setting up input prepares

Follow this procedure to add input prepare actions to the channel schedule, in order to prepare any input ahead of the switch action to that input.

**To include input prepare actions in a channel schedule**

1. As a one-time action, enable the input prepare feature in the channel. You must enable the feature while the channel is idle. See [Enabling and disabling the input prepare feature](input-prep-enable.md).

1. Plan the input switches and input prepares for the channel. See [Planning the start type for an input prepare](input-prep-plan-start.md).

1. If the associated input switch includes input clipping, see [Clipping the content of a file input](input-clipping.md).

   If the associated input switch is an input failover pair, see [Setting up dynamic inputs](dynamic-inputs.md).

1. Create the actions in the schedule. Typically, you create some prepare actions and switch actions before you start the channel for the first time. Then you add more actions over time. You add fixed switch actions, and follow switch actions. You add prepare actions as soon as you know that you will have an immediate switch some time in the future. Typically, you add all these actions while the channel is running, but you can also add them when the channel is idle.

   For detailed information on adding an input prepare action to the schedule, see [Creating an AWS Elemental MediaLive schedule](working-with-schedule.md).

**Topics**
+ [

# Enabling and disabling the input prepare feature
](input-prep-enable.md)
+ [

# Planning the start type for an input prepare
](input-prep-plan-start.md)
+ [

# Input prepare and dynamic inputs
](input-prep-dynamic.md)
+ [

# Input prepare with clipping
](input-prep-clip.md)
+ [

# Input prepare and automatic input failover
](input-prep-aif.md)

# Enabling and disabling the input prepare feature
Enabling the feature

Before you add input prepare actions to the MediaLive schedule, you must enable the feature.

**To enable the feature**
+ On the **Create channel** page, in **General settings**, in the **Feature activations** section, set **Input prepare schedule actions **to **Enabled**. 

**To disable the feature**

You can disable the input prepare feature. 

Typically, the only reason to disable input prepare is because you must [attach an RTMP pull input ](input-prep-rules.md)to the channel. 

1. Stop the channel. 

1. [Delete ](schedule-using-console-delete.md)all active and future input prepare actions from the schedule. You don't need to delete stale input prepare actions from the schedule.

1. On the **Create channel** page, in **General settings**, in the **Feature activation** section, set **Input prepare schedule actions **to **Disabled**. 

1. Attach the [RTMP pull input](creating-a-channel-step2.md) in the usual way.

**Topics**

# Planning the start type for an input prepare
Planning start

Before you add an input prepare action to the schedule, decide on the start type for the action. 

**Topics**
+ [

# Types of starts for input prepares
](plan-prep-start-types.md)
+ [

# Guidelines for choosing the start type
](plan-prep-tips.md)

# Types of starts for input prepares
Types of starts

There are three start types for input prepare actions in MediaLive. These start types are the same as the start types for input switches.
+ Fixed – the input prepare starts at a specific time.
+ Immediate – the input prepare starts as soon as you add the action to the schedule.
+ Follow – the input prepare follows a specific input switch—the *reference input switch*. It can have a start or an end *follow point*—it can follow the start of the reference input or the end of the reference input. 

With the follow start type, the following rules apply:
+ You can't use the console to create a follow input prepare with a follow point set to *start*. The start option is not shown on the console. Only the end option is shown.
+ MediaLive starts preparing the input *after *the reference input is active. Therefore:
  + For a follow-start prepare (which you can create only using the CLI), you must add the prepare action before the reference input has started in the channel. 

    If the reference switch is an immediate switch, you must include the switch action and the prepare action in the same [batch update command](about-batch-update-schedule.md).

    If the reference switch is a fixed or follow switch, you can add the switch action in one batch update command, and the prepare action in a later batch update command.
  + For a follow-end prepare, you must add the prepare action before the reference input has ended (before ingest has ended).
+ You can't create two follow prepare actions that both follow the same reference switch and the same follow point. Therefore:
  + You *cannot* create action 2 and action 4 to both follow the start of action 1. 
  + But you can create action 2 to follow the *start* of action 1, and action 4 to follow the *end* of action 1.

# Guidelines for choosing the start type
Guidelines for start type

Following are some guidelines for deciding which start type to use with an input prepare in the MediaLive schedule. 

Keep in mind that you can only prepare one switch at a time. When a prepare action starts, MediaLive starts preparing the input, and automatically stops any other active prepare input action. 

Therefore, the guiding principle is to make sure that you don't start preparing input X and accidentally *stop *preparing input Y, if input Y needs to be prepared before input X. 

**Topics**
+ [

## Scenario A
](#plan-prep-tips-scenario-A)
+ [

## Scenario B
](#plan-prep-tips-scenario-B)
+ [

## Scenario C
](#plan-prep-tips-scenario-C)
+ [

## Scenario D
](#plan-prep-tips-scenario-D)

## Scenario A


You are flipping between two inputs. The switch start is always undetermined, so that each switch is an immediate switch. There might be more switches interspersed among these switches, but they don't need preparing.

```
Switch to input A (immediate)
Switch to input B (immediate)
Switch to input A (immediate)
Switch to input B (immediate)
```

The easiest plan is to start preparing B after each switch to A, and to start preparing A after each switch to B. You could set up each prepare input action with any of these start types:
+ Fixed. The start time for prepare B is some time after the start time for switch A.
+ Immediate. Recommended. You could add the prepare B action at the same time as the immediate A switch, or shortly afterward.
+ Follow (start). You should add the prepare B action and the immediate A switch in the same [batch update command](about-batch-update-schedule.md). The reference action for the prepare B action is input A.
+ Follow (end). You can add the prepare B action at any time after switch A has been added to the schedule. The reference action for the prepare B action is input A.

For example:

```
Switch to input A (immediate)
Prepare input B (immediate)
Switch to input B (immediate)
Prepare input A (immediate)
Switch to input A (immediate)
Prepare input B (immediate)
Switch to input B (immediate)
```

## Scenario B


There is an immediate switch to A, then there are several fixed or follow switches. You anticipate that the next immediate switch will be to A again. 

```
Switch to input A (immediate)
Switch to input C (fixed or follow)
Switch to input D (fixed or follow)
Switch to input A (immediate)
```

After the switch to A, MediaLive continues preparing A. Therefore, there is no need to prepare it again. Furthermore, if input A is the only input that ever has an immediate switch, you can prepare A once, before the first time that you switch to it. You don't need to prepare it again.

## Scenario C


There is an immediate switch to A, then there are several fixed or follow switches. You anticipate that the next immediate switch will be to B. 

```
Switch to input A (immediate)
Switch to input C (fixed or follow)
Switch to input D (fixed or follow)
Switch to input B (immediate)
```

You know that the next immediate switch will be to input B, so you can start preparing it anytime after the switch to input A. You could set up each prepare input action with any of these start types:
+ Fixed. The start time for prepare B is at least 10 seconds before the start of switch B.
+ Immediate. Recommended. You could add the prepare B action at the same time as the immediate A switch, or shortly afterward.
+ Follow (start). Not recommended. You could, for example, set up the prepare B action to follow the start of switch C or the start of switch D.
+ Follow (end). Not recommended. You could, for example, set up the prepare B action to follow the end of switch A or the end of switch C. Don't set it up to follow the end of switch D.

For example:

```
Switch to input A (immediate)
Prepare input B (immediate)
Switch to input C (fixed or follow)
Switch to input D (fixed or follow)
Switch to input B (immediate)
```

## Scenario D


There is an immediate switch to input B, then there are several fixed or follow switches. You anticipate that there will be another immediate switch but initially you don't know if it will be to input B or input E. 

```
Switch to input A (immediate)
Switch to input C (fixed or follow)
Switch to input D (fixed or follow)
Switch to input B or E (immediate)
```

When you know which input you will switch to, you can start preparing it. When you want to prepare it, the current input could be A, C, or D. You could set up each prepare input action with any of these start types:
+ Fixed. The start time for prepare B (or E) is at least 10 seconds before the start of switch B (or E).
+ Immediate. Recommended. Add the prepare input action as soon as you know whether the switch will be to B or E.
+ Follow (start). Not recommended. You could, for example, set up the prepare B (or E) action to follow the start of switch C or the start of switch D.
+ Follow (end). Not recommended. You could, for example, set up the prepare B (or E) action to follow the end of switch A or the end of switch C. Don't set it up to follow the end of switch D.

For example:

```
Switch to input A (immediate)
Switch to input C (fixed or follow)
Switch to input D (fixed or follow)
Prepare input E (immediate)
Switch to input E (immediate)
```

# Input prepare and dynamic inputs


You can prepare for an input switch in a MediaLive channel when the associated input is a [dynamic input](dynamic-inputs.md). A dynamic input has a variable in its path. Each time that you add the input to the schedule, you specify a *replacement string* to replace the variable with a file.

When you set up the prepare input action, you must specify this replacement string. The string must exactly match the replacement string in the switch action. If the strings are not identical, MediaLive won't prepare the input in advance.

You might use this dynamic input more than once in the channel, and the replacement string might be different in each instance. Make sure that you change the string in each prepare action.

# Input prepare with clipping


You can prepare for an input switch in a MediaLive channel when the associated input is a file input that includes [input clipping](input-clipping.md).

When you set up the prepare input action, you must specify the start and end for the clip. The values that you enter must exactly match the start and end in the switch action. If the values are not identical, MediaLive won't prepare the input in advance.

You might use this file input more than once in the channel, and the start and end might be different in each instance. Make sure that you change the start and end in each prepare action.

# Input prepare and automatic input failover


Your MediaLive channel might include some inputs that are set up as [automatic input failover pairs](automatic-input-failover.md). 

When you set up the prepare input action for an input that is a failover pair, make sure that you specify the primary input as the associated input (in the **Input attachment** field on the **Create schedule action** page). If you specify the secondary input, MediaLive won't prepare the inputs in advance.

When MediaLive performs the prepare action, it prepares both inputs. This means that a later input switch action can be to either of the inputs in the failover pair.

Here is a scenario that illustrates some of the key behavior:

1. You prepare input A by specifying the primary input. The prepare starts.

1. You switch to input A by specifying the primary input. The channel switches to input A.

1. You then prepare input B. The prepare starts.

1. You notice that input A is degrading, so you switch to the secondary input. You don't have to prepare input A. Even though you have started to prepare input B, the secondary input for input A is still being prepared, as part of the automatic input failover process. Therefore, the switch proceeds seamlessly.

1. You switch away from input A.

1. You prepare input A again, because you are going to switch to it later. You specify the primary input. The prepare starts.

1. You switch to input A. But you then switch to the secondary input, because the primary input is still degraded. You can switch to the secondary input because, even though you specified the primary input in the prepare action, MediaLive always prepares both inputs.