

# Examples of handling captions in MediaLive


The following examples describe how to implement the use cases from [Typical scenarios for handling captions](typical-scenarios.md). 

**Topics**
+ [

# Use case A: One input format to one output and not converted
](use-case-one-input-format-to-one-output.md)
+ [

# Use case B: One input format converted to one different output format
](use-case-one-input-format-to-one-different-output-format.md)
+ [

# Use case C: One input format converted to different formats, one format for each output
](use-case-one-input-format-different-format-for-each-output.md)
+ [

# Use case D: One captions output shared by multiple video encodes
](use-case-one-captions-output-shared-by-multiple-video-encode.md)

# Use case A: One input format to one output and not converted
Use case A

This example for captions in MediaLive shows how to implement [the first use case](use-case-one-input-format-to-one-output-format-not-converted.md) from the typical scenarios. The input is set up with one format of captions and two or more languages. Assume that you want to maintain the format in the output, and that you want to produce only one type of output and include all the languages in that output.

For example, the input has embedded captions in English and French. You want to produce an HLS output that includes embedded captions in both English and French, plus one video and one audio.

This example illustrates two important features of an embedded passthrough workflow. First, you don't create separate captions selectors; all the languages are automatically included. Second, if you are outputting to HLS, there is an opportunity to specify the languages and the order in which they appear.

![\[Diagram showing captions selector, output with video and audio, and HLS output group.\]](http://docs.aws.amazon.com/medialive/latest/ug/images/captions_INembed_OUTembed_hls_result.png)


To set up for this use case, follow this procedure.

1. In the channel that you are creating, in the navigation pane, for **Input attachments**, choose the input.

1. For **General input settings**, choose **Add captions selector** to create one captions selector. Set **Selector settings** to **Embedded source**.

1. Create an HLS output group.

1. Create one output and set up the video and audio. 

1. In that same output, create one captions asset with the following:
   + **Captions selector name**: Captions selector 1.
   + **Captions settings**: One of the Embedded formats. 
   + **Language code** and **Language description**: Keep the field blank. With embedded captions, all the languages are included.

1. In the HLS output group, in **Captions**, for **Captions language setting**, choose **Insert**. 

1. For **HLS settings**, in **Captions language mappings**, choose **Add captions language mappings** twice (once for each language).

1. Complete the first group of mapping fields with **1**, **ENG**, and **English** and the second group with **2**, **FRE**, and **French**.

1. Finish setting up the channel and save it.

# Use case B: One input format converted to one different output format
Use case B

This example for captions in MediaLive shows how to implement [[the second use case](use-case-one-input-format-to-one-output-format-not-converted.md)](use-case-one-input-format-to-different-output-formats.md) from the typical scenarios. The input includes two captions languages, and the single output converts those captions. For example, the input has embedded captions in German and French. You want to produce a UDP output with both captions converted to DVB-Sub, plus one video and one audio. 

![\[Diagram showing captions flow from embedded German and French to DVB-Sub output.\]](http://docs.aws.amazon.com/medialive/latest/ug/images/captions_INembed_OUTdvb_udp_result.png)


To set up for this use case, follow this procedure.

1. In the channel that you are creating, in the navigation pane, for **Input attachments**, choose the input. 

1. For **General input settings**, choose **Add captions selector** twice, to create Captions selector 1 (for German) and Captions selector 2 (for French). In both cases, set **Selector settings** to **Embedded source**.

1. Create a UDP output group. 

1. Create one output and set up the video and audio.

1. In this output, choose **Add captions** to create a captions encode. 
   + **Captions selector name**: Captions selector 1. 
   + **Captions settings**: DVB-Sub. 
   + **Language code** and **Language description**: German.
   + Other fields: Keep the defaults or complete as desired. 

1. Choose **Add captions** again to create another captions encode. Set up this encode for the French captions. Make sure that you set up the font fields for German and French in exactly the same way. 

1. Finish setting up the channel and save it.

# Use case C: One input format converted to different formats, one format for each output
Use case C

This example for captions in MediaLive shows how to implement [[the third use case](use-case-one-input-format-to-one-output-format-not-converted.md)](use-case-one-input-format-to-several-output-formats.md) from the typical scenarios. The input is set up with one format of captions and two or more languages. You want to produce several different types of output. In each output, you want to convert the captions to a different format but include all the languages.

For example, the input has Teletext captions in Czech and Polish. Assume that you want to produce a Microsoft Smooth output and an HLS output. Assume that in the Microsoft Smooth output, you want to include one video and one audio and you want to convert the captions to TTML. In the HLS output, you want to include one video and one audio and you want to convert the captions to WebVTT.

![\[Diagram showing input captions and output formats for Microsoft Smooth and HLS groups.\]](http://docs.aws.amazon.com/medialive/latest/ug/images/captions_INttext_OUT_OPmss_hls_result.png)


To set up for this use case, follow this procedure.

1. In the channel that you are creating, in the navigation pane, for **Input attachments**, choose the input. 

1. For **General input settings**, choose **Add captions selector** twice to create the following captions selectors:
   + Captions selector 1 for Teletext Czech. Specify the page that holds the Czech captions.
   + Captions selector 2 for Teletext Polish. Specify the page that holds the Polish captions.

   Although you are including the captions in two different outputs (Microsoft Smooth and HLS), you need to extract them from the input only once, so you need to create only one captions selector for each language.

1. Create a Microsoft Smooth output group and configure it as follows: 
   + Create one output and set up the video and audio. 
   + Create a second output that contains one captions encode and no video or audio encodes, and with the following settings: 
     + **Captions selector name**: Captions Selector 1.
     + **Captions settings**: TTML. 
     + **Language code** and **Language description**: Czech.
     + **Style control**: Set as desired.
   + Create a third output that contains one captions encode and no video or audio encodes, with the following settings:
     + **Captions selector name**: Captions Selector 2.
     + **Captions settings**: TTML.
     + **Language code** and **Language description**: Polish.
     + Other fields: same as the second output (the Czech captions).

1. Create an HLS output group and configure it as follows: 
   + Create one output and set up the video and audio. 
   + Create a second output that contains one captions encode and no video or audio encodes, and with the following settings: 
     + **Captions selector name**: Captions Selector 1.
     + **Captions settings**: WebVTT. 
     + **Language code** and **Language description**: Czech.
     + Other fields: Set as desired.
   + Create a third captions output that contains one captions encode and no video or audio encodes, and with the following settings:
     + **Captions selector name**: Captions Selector 2.
     + **Captions settings**: WebVTT
     + **Language code** and **Language description**: Polish.
     + Other fields: same as the second output (the Czech captions).

1. Finish setting up the channel and save it.

# Use case D: One captions output shared by multiple video encodes
Use case D

This example for captions in MediaLive shows how to set up captions in an ABR workflow. 

The first setup shows how to set up an ABR workflow when the captions are in the same output as the video, meaning that the captions are either embedded or captions style.

The second setup shows how to set up an ABR workflow when the captions belong to the sidecar category, in which case each captions encode is in its own output.

**Topics**
+ [

# Setup with Embedded or object-style captions
](setup-with-procedure-a-captions.md)
+ [

# Setup with sidecar captions
](setup-with-procedure-b-captions.md)

# Setup with Embedded or object-style captions


This example for captions in MediaLive shows how to implement [[the fourth use case](use-case-one-input-format-to-one-output-format-not-converted.md)](use-case-one-captions-output-multiple-video-encodes.md) from the typical scenarios. For example, you want to produce an HLS output with three video encodes (one for low-resolution video, one for medium, one for high) and one audio. You also want to include embedded captions (in English and Spanish) and associate them with all three video encodes.

![\[Diagram showing input captions and output configurations for video and audio in MediaLive.\]](http://docs.aws.amazon.com/medialive/latest/ug/images/captions_INembed_OUTembed_ABRhls_result.png)


To set up for this use case, follow this procedure.

1. In the channel that you are creating, in the navigation pane, in **Input attachments**, choose the input. 

1. For **General input settings**, choose **Add captions selector** to create one captions selector. Set **Selector settings** to **Embedded source**.

1. Create an HLS output group.

1. Create one output and set up the video and audio for low-resolution video.

1. In that same output, create one captions asset with the following:
   + **Captions selector name**: Captions selector 1.
   + **Captions settings**: One of the Embedded formats. 
   + **Language code** and **Language description**: Leave blank; with embedded passthrough captions, all the languages are included.

1. Create a second output and set up the video and audio for medium-resolution video.

1. In that same output, create one captions asset with the following:
   + **Captions selector name**: Captions selector 1.
   + **Captions settings**: One of the Embedded formats. 
   + **Language code** and **Language description**: Keep blank. With embedded captions, all the languages are included.

1. Create a third output and set up the video and audio for high-resolution video.

1. In that same output, create one captions asset with the following:
   + **Captions selector name**: Captions selector 1.
   + **Captions settings**: One of the Embedded formats. 
   + **Language code** and **Language description**: Keep blank. With embedded captions, all the languages are included.

1. Finish setting up the channel and save it. 

# Setup with sidecar captions


This example for captions in MediaLive shows an ABR workflow where the captions are in sidecars. For example, you want to produce a Microsoft Smooth output with three video encodes (one for low-resolution video, one for medium, one for high) and one audio. These encodes are in a Microsoft Smooth output. You want to ingest embedded captions (in English and Spanish) and convert them to TTML captions, one for English and one for Spanish. 

![\[Diagram showing output groups for video, audio, and captions in English and Spanish.\]](http://docs.aws.amazon.com/medialive/latest/ug/images/captions_INembed_OUTembed_ABRmss_result.png)


To set up for this use case, follow this procedure.

1. In the channel that you are creating, in the navigation pane, for **Input attachments**, choose the input. 

1. For **General input settings**, choose **Add captions selector** twice to create the following captions selectors:
   + Captions selector 1: for Embedded English.
   + Captions Selector 2: for Embedded Spanish.

1. Create a Microsoft Smooth output group.

1. Create one output that contains one video encode and set it up for low-resolution video.

1. Create a second output that contains one video encode and set it up for medium-resolution video.

1. Create a third output that contains one video encode and set it up for high-resolution video.

1. Create a fourth output that contains one audio encode and no video encode.

1. Create a fifth output that contains one captions encode and no video or audio encodes, and with the following settings for the captions encode:
   + **Captions selector name**: Captions selector 1.
   + **Captions settings**: TTML. 
   + **Language code** and **Language description**: English.

1. Create a sixth output that contains one captions encode and no video or audio encodes, and with the following settings for the captions encode:
   + **Captions selector name**: Captions selector 2.
   + **Captions settings**: TTML. 
   + **Language code** and **Language description**: Spanish.

1. Finish setting up the channel and save it. 