

# Implementing a trick-play track
<a name="trick-play-solutions"></a>

Trick-play is used in digital video players to mimic some capabilities of analog players, including fast-forward and rewind capabilities. These capabilities often include a trick-play *track*—a visual cue for the person using the video player. In AWS Elemental MediaLive, you can include track assets in the output group. The downstream system for that output group can use these assets to implement the visual cue in their trick-play implementation. 

MediaLive provides two methods for including these assets:
+ An I-frame-only manifest that conforms with the HLS specification.
+ A trick-play track that conforms with the Image Media Playlist specification, version 0.4. 

MediaLive supports these methods as follows:
+ In HLS output groups, MediaLive supports both methods.
+ In MediaPackage output groups, MediaLive supports trick-play via the Image Media playlist specification

## Choosing an implementation of trick-play track
<a name="trick-play-choosing"></a>

You can follow one or both trick-play methods in the same output group. 

Before you follow either method, contact the downstream system for the output group to find out how they implement trick-play. Find out the following: 
+ Can the downstream system support a trick-play track? If so, which trick-play specification does it follow?
+ Is the supported implementation required or optional? Both of these implementations introduce specific lines into the HLS manifest. If the lines are absent, the downstream system will fail to handle the output from MediaLive?

  It is likely that the downstream system considers both of these implementations to be optional.
+ If you choose the I-frame-only manifest method, confirm that the downstream system supports the method according to the HLS specification. If the downstream system has a variation, it's possible that the downstream system won't be able to handle the output from MediaLive. MediaLive doesn't support customizations of the method.
+ If you choose the image media playlist method, confirm that the downstream system supports the method according to the Image Media Playlist specification. If the downstream system has a variation, it's possible that the downstream system won't be able to handle the output from MediaLive. MediaLive doesn't support customizations of the implementation. 

**Topics**
+ [Choosing an implementation of trick-play track](#trick-play-choosing)
+ [Trick-play track via I-frames](trick-play-i-frames.md)
+ [Trick-play track via the Image Media Playlist specification](trick-play-roku.md)

# Trick-play track via I-frames
<a name="trick-play-i-frames"></a>

In a MediaLive HLS output group, you can support trick-play track by providing an I-frame-only manifest.

## How the method works
<a name="trick-play-iframe-how-it-works"></a>

When you create the HLS output group, you create one or more video outputs, in the usual way. For a reminder of the output group structure, look at the diagrams in [Organize encodes in an HLS output group](design-hls-package.md). In the output group, you enable the field to create an I-frame-only manifest that conforms to the HLS specification. 

MediaLive produces two child manifests for each encode—one manifest for handling the video in the usual way, and the I-frame-only manifest. The I-frame-only manifest lets the downstream player identify specific video frames to request, to construct the trick-play track. So this trick-play track method doesn't produce additional encodes in the output group. 

Each I-frame-only manifest contains the following:
+ One `#EXT-X-I-FRAMES-ONLY `tag, to indicate that the manifest is I-frame-only.
+ Many `#EXT-X-BYTERANGE `entries. Each entry identifies the position of an I-frame position.

## Setting up
<a name="trick-play-iframe-procedure"></a>

You set up the trick-play track once for the entire MediaLive HLS output group.

**Note**  
The information in this section assumes that you are familiar with the general steps for [creating a channel](creating-channel-scratch.md).

**To set up an I-frame-only manifest**

Include these steps when you create the HLS output group. 

1. In the **HLS output group**, in **Manifest and segments**, for **I-frame only playlists**, choose **ENABLED**.

1. Set up the remaining fields in the output group [as you normally would](creating-hls-output-group.md). Set up the video, audio, and captions outputs and encodes [as you normally would](creating-a-channel-step6.md).

# Trick-play track via the Image Media Playlist specification
<a name="trick-play-roku"></a>

In a MediaLive HLS or MediaPackage output group, you can support a trick-play track by providing an asset that follows the Image Media Playlist specification, version 0.4. The MediaLive implementation follows the time-based method of the specification. The specification is located here:

[https://github.com/image-media-playlist/spec/blob/master/image_media_playlist_v0_4.pdf](https://github.com/image-media-playlist/spec/blob/master/image_media_playlist_v0_4.pdf)

Roku is one example of a platform that implements this specification.

## How the method works
<a name="trick-play-roku-how-it-works"></a>

When you create the output group, you create standard outputs in the usual way for the video, audio, and captions encodes. See [Organize encodes in an HLS output group](design-hls-package.md) for diagrams that illustrate the structure of the encodes in the output group. 

You also create one output that contains one frame capture encode. The encode is a series of JPEG files, one file for every video segment, which means that the capture follows the segmentation of the video encode. This encode is the asset that the downstream player can use to implement the trick-play track. 

MediaLive creates a main manifest and child manifests in the usual way. The main manifest includes an `EXT-X-IMAGE-STREAM-INF` tag for the frame capture encode. The child manifest for the frame capture encode contains `EXT-X-IMAGES-ONLY` tags. The contents and format of these tags comply with the Image Media Playlist specification.

## Setting up
<a name="trick-play-roku-procedure"></a>

You set up the trick-play track in the output group by creating an additional output that contains a video encode consisting of frame captures. You can add up to three frame capture outputs in one output group, and up to three frame capture encodes in the channel.

**Note**  
The information in this section assumes that you are familiar with the general steps for [creating a channel](creating-channel-scratch.md).

**To set up the frame capture encode in an HLS output group**

To create a frame capture encode in an HLS output group, you create a special type of output and set its video codec to **Frame Capture**.

1. In the **HLS output group**, in **HLS outputs**, choose **Add output** to add another output.

1. For that output, choose **Settings**, and in **Output settings**, set **HLS settings** to **Frame capture hls**.

1. In **Stream settings**, choose **Video** and set up the video fields, including:
   + **Width** and **Height** – Contact your downstream system to obtain the correct values. If you guess at the values, the experience on the downstream player might not be optimal.
   + **Codec settings** – Choose **Frame capture**. 
   + **Capture interval** – Don't change the value of this field. Leave it empty, so that the frame capture uses the default interval.

1. Choose **Audio 1** and choose **Remove audio** so that the container has only one encode (a video encode).

**To set up the frame capture encode in a MediaPackage output group**

To create a frame capture encode in a MediaPackage output group, you create a regular output and set its video codec to **Frame Capture**.

1. In the **MediaPackage output group**, in **MediaPackage outputs**, choose **Add output** to add another output.

1. For that output, choose **Settings**, and then choose **Stream settings**. In **Stream settings**, choose **Video**. 

1. In **Codec settings**, choose **Frame capture**. 

1. Set up the other video fields, including:
   + **Width** and **Height** – Contact your downstream system to obtain the correct values. If you guess at the values, the experience on the downstream player might not be optimal.
   + **Capture interval** – Don't change the value of this field. Leave it empty, so that the frame capture uses the default interval.

1. Choose **Audio 1** and choose **Remove audio** so that the container has only one encode (a video encode).

The output is part of the ABR stack and has the same destination as the other encodes in the HLS or MediaPackage output group.