

# Using video overlays
<a name="video-overlays"></a>

With the **Video overlays** feature, you can layer video content from multiple videos simultaneously. You can also dynamically move or resize video content over time. 

Video overlays allow for many creative possibilities. Some examples of common workflows might include the following:
+ Provide alternate footage for a scene.
+ Blank out content, such as content captured during a live broadcast or content you don't have the rights to.
+ Shrink your primary content while an ad plays.

**Topics**
+ [How to overlay a full screen video](video-overlays-add.md)
+ [How to shrink content during ad playback (picture-in-picture)](overlay-shrink-pip.md)
+ [How to shrink content during ad playback (merge squeeze)](overlay-shrink.md)
+ [Video overlay feature limitations](video-overlays-restrictions.md)

# How to overlay a full screen video
<a name="video-overlays-add"></a>

The following procedure describes how to display a full screen video overlay for a duration that you specify.

## MediaConvert console
<a name="collapsible-section-1"></a>

**To add a video overlay by using the MediaConvert console:**

1. Open the [Create job](https://console.aws.amazon.com/mediaconvert/home#/jobs/create) page in the MediaConvert console.

1. Specify an input video. For more information, see *Step 1: Input files* in [ Configuring jobs](setting-up-a-job.md#specify-input-settings).

1. In the settings for your input, next to **Video overlays**, choose **Add overlay**. 

1. Specify an Input file URL.

1. Specify a **Start timecode**.

1. Specify an **End timecode**.

1. Optionally add any **Input clips** for your video overlay.

## API, SDK, or AWS Command Line Interface (AWS CLI)
<a name="collapsible-section-2"></a>

To specify a video overlay using the API, SDK, or AWS Command Line Interface (AWS CLI), include `VideoOverlays` in your job settings JSON.

The following is an excerpt of a job settings JSON that specifies a full screen video overlay at timecode `00:10:00:00` for one minute from a clipped input:

```
{
  "Settings": {
    "Inputs": [
      {
        "VideoOverlays": [
          {
            "Input": {
              "FileInput": "s3://amzn-s3-demo-bucket/overlay.mp4",
              "InputClippings": [
                {
                  "StartTimecode": "00:10:00:00",
                  "EndTimecode": "00:11:00:00"
                }
              ],
              "TimecodeSource": "EMBEDDED"
            },
            "StartTimecode": "00:01:00:00",
            "EndTimecode": "00:02:00:00"
          }
        ]
      }
    ]
  }
}
```

# How to shrink content during ad playback (picture-in-picture)
<a name="overlay-shrink-pip"></a>

The following procedure describes how to reduce the size of your primary content (to 20 percent) while displaying an advertisement in full screen. In steps 3 through 7, you specify a full screen ad. In steps 8 through 12, you temporarily shrink your base input video.

## MediaConvert console
<a name="collapsible-section-1"></a>

**To add a video overlay by using the MediaConvert console:**

1. Open the [Create job](https://console.aws.amazon.com/mediaconvert/home#/jobs/create) page in the MediaConvert console.

1. Specify an input video. For more information, see *Step 1: Input files* in [ Configuring jobs](setting-up-a-job.md#specify-input-settings).

1. In the settings for your input, next to **Video overlays**, choose **Add overlay**. 

1. Specify an Input file URL for your ad file.

1. Specify a **Start timecode**.

1. Specify an **End timecode**.

1. Optionally add any **Input clips** for your video overlay.

1. Add a separate overlay by choosing **Add overlay**. This overlay provides the animated resizing transitions for your base input video.

1. Choose **Add transition**. 

1. In the **Transition**, specify the following: **Height**: 20, **Width**: 20, **X position**: 75, **Y position**: 75, specify a **Start timecode**, and specify an **End timecode**.

1. Choose **Add transition**.

1. In the **Transition**, specify the following: **Height**: 100, **Width**: 100, **X position**: 0, **Y position**: 0, specify a **Start timecode** some time after the previous transition, and specify an **End timecode**.

## API, SDK, or AWS Command Line Interface (AWS CLI)
<a name="collapsible-section-2"></a>

To specify a video overlay using the API, SDK, or AWS Command Line Interface (AWS CLI), include `VideoOverlays` in your job settings JSON.

The following is an excerpt of a job settings JSON that specifies a full screen ad and temporarily reduces the size of your base input video:

```
{
  "Settings": {
    "Inputs": [
      {
        "VideoOverlays": [
          {
            "EndTimecode": "00:00:18:00",
            "InitialPosition": {
              "Height": 100,
              "Unit": "PERCENTAGE",
              "Width": 100,
              "XPosition": 0,
              "YPosition": 0
            },
            "Input": {
              "FileInput": "s3://amzn-s3-demo-bucket/advertisement.mp4",
              "InputClippings": [
                {
                  "EndTimecode": "00:01:15:02",
                  "StartTimecode": "00:00:45:00"
                }
              ],
              "TimecodeSource": "ZEROBASED"
            },
            "StartTimecode": "00:00:13:00"
          },
          {
            "Transitions": [
              {
                "EndPosition": {
                  "Height": 20,
                  "Unit": "PERCENTAGE",
                  "Width": 20,
                  "XPosition": 75,
                  "YPosition": 75
                },
                "EndTimecode": "00:00:13:40",
                "StartTimecode": "00:00:13:00"
              },
              {
                "EndPosition": {
                  "Height": 100,
                  "Unit": "PERCENTAGE",
                  "Width": 100,
                  "XPosition": 0,
                  "YPosition": 0
                },
                "EndTimecode": "00:00:18:00",
                "StartTimecode": "00:00:17:40"
              }
            ]
          }
        ]
      }
    ]
  }
}
```

# How to shrink content during ad playback (merge squeeze)
<a name="overlay-shrink"></a>

The following procedure describes how to reduce the size of your primary content (to 75 percent) while displaying an advertisement beneath it. In steps 3 through 12, you specify a full screen ad. In steps 12 through 17, you temporarily shrink your base input video.

## MediaConvert console
<a name="collapsible-section-1"></a>

**To add a video overlay by using the MediaConvert console:**

1. Open the [Create job](https://console.aws.amazon.com/mediaconvert/home#/jobs/create) page in the MediaConvert console.

1. Specify an input video. For more information, see *Step 1: Input files* in [ Configuring jobs](setting-up-a-job.md#specify-input-settings).

1. In the settings for your input, next to **Video overlays**, choose **Add overlay**. 

1. Specify an Input file URL for your ad file.

1. Specify a **Start timecode**.

1. Specify an **End timecode**.

1. For **Initial position**, specify the following: **Height**: 125, **Width**: 125, **X position**: -25, **Y position**: 0, **Unit**: Percentage, specify a **Start timecode**, and specify an **End timecode**.

1. Choose **Add transition**. 

1. In the **Transition**, specify the following: **Height**: 100, **Width**: 100, **X position**: 0, **Y position**: 0, **Unit**: Percentage, specify a **Start timecode**, and specify an **End timecode**.

1. Choose **Add transition**. 

1. In the **Transition**, specify the following: **Height**: 125, **Width**: 125, **X position**: -25, **Y position**: 0, **Unit**: Percentage, specify a **Start timecode**, and specify an **End timecode**.

1. Optionally add any **Input clips** for your video overlay.

1. Add a separate overlay by choosing **Add overlay**. This overlay provides the animated resizing transitions for your base input video.

1. Choose **Add transition**. 

1. In the **Transition**, specify the following: **Height**: 75, **Width**: 75, **X position**: 25, **Y position**: 0, **Unit**: Percentage, specify a **Start timecode**, and specify an **End timecode**.

1. Choose **Add transition**.

1. In the **Transition**, specify the following: **Height**: 100, **Width**: 100, **X position**: 0, **Y position**: 0, **Unit**: Percentage, specify a **Start timecode** some time after the previous transition, and specify an **End timecode**.

## API, SDK, or AWS Command Line Interface (AWS CLI)
<a name="collapsible-section-2"></a>

To specify a video overlay using the API, SDK, or AWS Command Line Interface (AWS CLI), include `VideoOverlays` in your job settings JSON.

The following is an excerpt of a job settings JSON that specifies a full screen ad and temporarily reduces the size of your base input video:

```
{
  "Settings": {
    "Inputs": [
      {
        "VideoOverlays": [
          {
            "InitialPosition": {
              "Height": 125,
              "Unit": "PERCENTAGE",
              "Width": 125,
              "XPosition": -25,
              "YPosition": 0
            },
            "Input": {
              "FileInput": "s3://amzn-s3-demo-bucket/advertisement.mov"
            },
            "Transitions": [
              {
                "EndPosition": {
                  "Height": 100,
                  "Unit": "PERCENTAGE",
                  "Width": 100,
                  "XPosition": 0,
                  "YPosition": 0
                },
                "EndTimecode": "00:00:14:00",
                "StartTimecode": "00:00:13:00"
              },
              {
                "EndPosition": {
                  "Height": 125,
                  "Unit": "PERCENTAGE",
                  "Width": 125,
                  "XPosition": -25,
                  "YPosition": 0
                },
                "EndTimecode": "00:00:19:30",
                "StartTimecode": "00:00:18:30"
              }
            ]
          },
          {
            "Transitions": [
              {
                "EndPosition": {
                  "Height": 75,
                  "Unit": "PERCENTAGE",
                  "Width": 75,
                  "XPosition": 25,
                  "YPosition": 0
                },
                "EndTimecode": "00:00:14:00",
                "StartTimecode": "00:00:13:00"
              },
              {
                "EndPosition": {
                  "Height": 100,
                  "Unit": "PERCENTAGE",
                  "Width": 100,
                  "XPosition": 0,
                  "YPosition": 0
                },
                "EndTimecode": "00:00:19:30",
                "StartTimecode": "00:00:18:30"
              }
            ]
          }
        ]
      }
    ]
  }
}
```

# Video overlay feature limitations
<a name="video-overlays-restrictions"></a>

Video overlays have the following restrictions:
+ MediaConvert does not support audio playback or separate captions for video overlays. During a video overlay, any audio or captions from your base input video will continue uninterrupted.
+ Video overlays are specific to individual video inputs. For example, if your job settings include three video inputs, you can add an individual video overlay to **Input 1**, **Input 2**, and/or **Input 3**. You cannot however add a single video overlay that spans across all three inputs.
+ You can include up to 99 video overlays in your job settings and up to 99 input clips in each video overlay.
+ MediaConvert does not support transparency for video overlays. Any alpha channels present in your input will be black in your output.
+ For consistency in color and formatting in your output video image, we recommend that you specify video overlay files with accurate and complete color metadata.