Configure low latency, publishing and DVR redundancy, and encryption parameter overrides.

## Optimize end-to-end latency

Configure the encoding output, catalog, and packaging input together to reduce end-to-end latency.

Use the same stream address for the encoding output and packaging input.

1. Create and configure the encoding service:

   1. Configure the parameters as for any other service:

      - Configure the **General** parameters.
      - Configure the source parameters in the **Input** tab.
      - Configure the video and audio parameters in the **Media processing** tab.
      - Select the export type and all the encoding parameters in the **Encoding** tab.
   2. Add and configure as many outputs as needed in the **Output** tab and:

      - Tick the **Direct Path for low latency** checkbox in the **Common MPEG-2 TS parameters** section.
      - Enter the publication IP address in the **Output stream** section.

2. Create and configure a catalog:

   1. Add an **HLS or DASH over CMAF** output to the catalog.

   2. Configure the **General** parameters and tick the **Low latency** checkbox in the **General parameters** section.

   3. Configure the remaining output parameters as for any other catalog output:

      - Configure the DASH parameters if needed.
      - Configure the HLS parameters if needed.
      - Configure the delivery parameters.

3. Create and configure the Live Packaging service:

   1. Configure the **Ingest** parameters and:

      - Enter the same **Stream** IP address as set up in the output tab of the service.
      - Tick the **Direct Path for low latency** checkbox.
   2. Configure the DVR parameters:

      - Define the storage location for the DVR.
      - Set the DVR duration.
      - Set the DVR writing mode to **Low latency**.
   3. Associate the  service with the catalog that contains the **HLS or DASH over CMAF** output configured with the **Low latency** parameter.

4. Start the encoding and packaging services.

End-to-end latency is now reduced compared with other services.

## Publish Redundancy mode for MediaKind Packager

In order to guarantee service delivery to consumers, MediaKind Packager provides the following Publishing redundancy mode: [1+1 active / standby server mode](/traditional-products-and-appliances/components/packager/use-cases#configure-the-publishing-synchronization-between-two-servers)

<blockquote data-callout="caution"><strong>Caution</strong><p>The Publishing redundancy is only available:</p><ul>&#10;<li>in distributed deployment mode where at least two MediaKind Packaging servers are synchronized;</li>&#10;<li>for HLS and HSS live services.</li>&#10;</ul></blockquote>

### Configure the synchronization between MediaKind Packager servers

Synchronizing your pool of MediaKind Packager servers mode allows you to record and deliver the same content on distinct servers and therefore ensures a transparent failover of the service with no impact on the delivery network and the consumer.

To configure the synchronization between servers, follow these steps:

1. Open the common configuration file of **server A** using vi editor:

   ```
   # vi /etc/mediakind/mkp/charts/customer-values.yaml
   ```

2. Edit the Synchronization values in the dvrManager section:

   ```
   dvrManager:
       synchronizer:
           port: 1234
           nicName: eth1
           address: 233.252.0.1
           type: udp
   ```

   - type: Set the value to `udp` (communication between the MediaKind Packager servers is done with the UDP protocol). Default value is `none`.
   - address: Enter a multicast address used for the UDP communication.
   - nicName: Enter the name of the nic used for the UDP communication (`enXXXXXX`).
   - port: Enter the port used for the UDP communication.

   If you want to define multicastSources, add this field as an array in synchonizer definition:

   ````
   ```
   dvrManager:
       synchronizer:
           port: 1234
           nicName: eth1
           address: 233.252.0.1
           type: udp
           multicastSources: |
               ["192.0.2.10"]
   ```
   ````

   In case of multiple multicast addresses, define this list as below :

   ````
   ```
   dvrManager:
       synchronizer:
           port: 1234
           nicName: eth1
           address: 233.252.0.1
           type: udp
           multicastSources: |
               ["192.0.2.10", "192.0.2.11", "192.0.2.12"]
   ```
   ````

3. Configure the Channel Routing feature in the advancedSettings section:

   ```
   originserver:
     advancedSettings:
       useChannelRouting: true
   ```

4. Execute the following script to apply the changes:

   ```
   # /etc/mediakind/mkp/charts/apply_customer_values.sh
   ```

5. Repeat on each MediaKind Packager server using the same parameters.

### Configure the publishing synchronization between two servers

The Servers synchronization mode is already configured.

Synchronizing your pool of MediaKind Packager servers mode allows you to deliver the same content from two distinct servers and therefore ensures a transparent failover of the service with no impact on the delivery network and the consumer.

Publication is done in active / standby mode. The standby publishing server become active when:

- The current active publishing server becomes unavailable (after a shutdown or unexpected error);
- The link between the two servers is broken.

<blockquote data-callout="note"><strong>Note</strong><p>There is no automatic switch back when the initial active server is back online.</p></blockquote>

To configure the synchronization between servers, follow these steps:

1. Open the common configuration file of **server A** using vi editor:

   ```
   # vi /etc/mediakind/mkp/charts/customer-values.yaml
   ```

2. Edit the Synchronization values in the publisher section:

   ```
   publisher:
       synchronizer:
           port: 1234
           nicName: eth1
           address: 233.252.0.1
           type: udp
   ```

   - port: Enter the port used for the UDP communication.
   - nicName: Enter the name of the nic used for the UDP communication (`enXXXXXX`).
   - address: Enter a multicast address used for the UDP communication.
   - type: Set the value to `udp` (communication between the MediaKind Packager servers is done with the UDP protocol). Default value is `none`.

   If you want to define multicastSources, add this field as an array in synchonizer definition:

   ````
   ```
   publisher:
       synchronizer:
           port: 1234
           nicName: eth1
           address: 233.252.0.1
           type: udp
           multicastSources: |
               ["192.0.2.10"]
   ```
   ````

   In case of multiple multicast addresses, define this list as below :

   ````
   ```
   publisher:
       synchronizer:
           port: 1234
           nicName: eth1
           address: 233.252.0.1
           type: udp
           multicastSources: |
               ["192.0.2.10", "192.0.2.11", "192.0.2.12"]
   ```
   ````

3. Edit the Channel Routing feature:

   ```
   originserver:
     advancedSettings:
       useChannelRouting: true
   ```

   useChannelRouting: Set the value to `true`.

4. Execute the following script to apply the changes:

   ```
   # /etc/mediakind/mkp/charts/apply_customer_values.sh
   ```

5. Repeat on each MediaKind Packager server using the same parameters.

## DVR Redundancy mode for MediaKind Packager

In order to guarantee service delivery to consumers, MediaKind Packager provides the following DVR redundancy modes:

- [Server auto-assignment](/traditional-products-and-appliances/components/packager/use-cases#server-auto-assignment)
- [1+1 active / active server mode](/traditional-products-and-appliances/components/packager/use-cases#11-active--active-server-mode)

<blockquote data-callout="caution"><strong>Caution</strong><p>The DVR redundancy is only available in distributed deployment mode where at least two MediaKind Packager servers are synchronized.</p></blockquote>

### Configure synchronization between MediaKind Packager servers

Synchronizing your pool of MediaKind Packager servers mode allows you to record and deliver the same content on distinct servers and therefore ensures a transparent failover of the service with no impact on the delivery network and the consumer.

To configure the synchronization between servers, follow these steps:

1. Open the common configuration file of **server A** using vi editor:

   ```
   # vi /etc/mediakind/mkp/charts/customer-values.yaml
   ```

2. Edit the Synchronization values in the dvrManager section:

   ```
   dvrManager:
       synchronizer:
           port: 1234
           nicName: eth1
           address: 233.252.0.1
           type: udp
   ```

   - type: Set the value to `udp` (communication between the MediaKind Packager servers is done with the UDP protocol). Default value is `none`.
   - address: Enter a multicast address used for the UDP communication.
   - nicName: Enter the name of the nic used for the UDP communication (`enXXXXXX`).
   - port: Enter the port used for the UDP communication.

3. Configure the Channel Routing feature in the advancedSettings section:

   ```
   originserver:
     advancedSettings:
       useChannelRouting: true
   ```

4. Execute the following script to apply the changes:

   ```
   # /etc/mediakind/mkp/charts/apply_customer_values.sh
   ```

5. Repeat on each MediaKind Packager server using the same parameters.

### Server auto-assignment

- Your MediaKind headend is composed of at least two synchronized MediaKind Packager servers.
- You have created and configured one Catalog that contains at least one output.
- You have created and configured one Live Packaging service that:
  - contains at least one source and a publishing point.
  - is linked to an existing Catalog.

The Server auto-assignement mode allows you to let your MediaKind solution manage the services work load amongst all your MediaKind Packager servers. When a new service is started, the service processing is dynamically assigned to the least loaded server.

To start the service with an auto-assigned server, follow these steps:

1. Click the **Services** link in the left panel from the Packager user interface.

2. Click the field in the **Mandatory** column to display available servers.

3. Select **AUTO**.

4. Click the play button in the **Actions** column to start the related service. The service status turns from **stopped** to **started**.

The service is processed on the elected MediaKind Packager server. If the server comes to fail, a new MediaKind Packager server will be elected from the pool of servers and the service will resume from this new server.

### 1+1 active / active server mode

- Your MediaKind headend is composed of at least two synchronized MediaKind Packager servers.
- You have created and configured one Catalog that contains at least one output.
- You have created and configured one Live Packaging service that:
  - contains at least one source and a publishing point.
  - is linked to an existing Catalog.

The 1+1 active / active server mode allows you to assign one Live Packaging service to two MediaKind Packager servers. Both servers will therefore process the service and guarantee the availability of the content even if one server may come to fail.

To start the service with the two servers, follow these steps:

1. Access the MediaKind Packager user interface and click the **Services** link in the left panel.

2. Click the field in the **Mandatory** column to display available servers.

3. Select one server. Do not select AUTO in this mode.

4. Repeat to select the second server. Do not select AUTO in this mode.

5. Click the play button in the **Actions** column to start the related service. The service status turns from **stopped** to **started**.

The service is processed on both MediaKind Packager servers. If one server comes to fail, the content will still be available on the other server.

## Parameters mapping key for encryption

MediaKind Packager catalogs and their specifically configured outputs can be combined with any existing Live or On-Demand packaging services.

The Parameters mapping key functionality allows you to override some of these parameters with the parameters of a Live or On-Demand packaging service and therefore adapts the assets delivery requirements without having to multiply the catalog outputs.

To override the parameters of an output with the parameters of a Live or On-Demand packaging service, you must enter an identical key on both:

- Output configuration page:

  The **Parameters mapping key** field must be filled with a unique key value.

- Live or On-Demand packaging service configuration page:

  The **Key** field is composed of the **Parameters mapping key** value followed by the parameter to be changed.

  The **Value** field must be filled with the parameter value that will override the existing output parameter value.

<table>
  <thead>
    <tr>
      <th style="text-align: left">Encryption mode</th>
      <th style="text-align: left">Key</th>
      <th style="text-align: left">Value</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="text-align: left">Common overloadable parameters for all encryptions</td>
      <td style="text-align: left"><code>contentId</code></td>
      <td style="text-align: left">Value of the content ID</td>
    </tr>
    <tr>
      <td style="text-align: left">HLS with Fairplay fixed key</td>
      <td style="text-align: left"><code>protection.key</code></td>
      <td style="text-align: left">Encryption key</td>
    </tr>
    <tr>
      <td style="text-align: left">HLS with Fairplay fixed key</td>
      <td style="text-align: left"><code>protection.keyId</code></td>
      <td style="text-align: left">Key identifier</td>
    </tr>
    <tr>
      <td style="text-align: left">HLS with Fairplay fixed key</td>
      <td style="text-align: left"><code>protection.iv</code></td>
      <td style="text-align: left">Initialization vector</td>
    </tr>
    <tr>
      <td style="text-align: left">HLS with Fairplay fixed key</td>
      <td style="text-align: left"><code>protection.uri</code></td>
      <td style="text-align: left">Uri</td>
    </tr>
    <tr>
      <td style="text-align: left">HLS with Fairplay fixed key</td>
      <td style="text-align: left"><code>protection.keyForrmat</code></td>
      <td style="text-align: left">Key format</td>
    </tr>
    <tr>
      <td style="text-align: left">HLS with Fairplay fixed key</td>
      <td style="text-align: left"><code>protection.keyFormatVersions</code></td>
      <td style="text-align: left">Key format version</td>
    </tr>
    <tr>
      <td style="text-align: left">HSS with PlayReady fixed key</td>
      <td style="text-align: left"><code>protection.key</code></td>
      <td style="text-align: left">Encryption key</td>
    </tr>
    <tr>
      <td style="text-align: left">HSS with PlayReady fixed key</td>
      <td style="text-align: left"><code>protection.keyId</code></td>
      <td style="text-align: left">Key identifier</td>
    </tr>
    <tr>
      <td style="text-align: left">HSS with PlayReady fixed key</td>
      <td style="text-align: left"><code>protection.licenseAcquisitionUrl</code></td>
      <td style="text-align: left">URL for license acquisition</td>
    </tr>
    <tr>
      <td style="text-align: left">HSS with PlayReady fixed key</td>
      <td style="text-align: left"><code>protection.domainServiceId</code></td>
      <td style="text-align: left">Domain service ID</td>
    </tr>
    <tr>
      <td style="text-align: left">HSS with PlayReady fixed key</td>
      <td style="text-align: left"><code>protection.licenseUiUrl</code></td>
      <td style="text-align: left">User URL for license check</td>
    </tr>
    <tr>
      <td style="text-align: left">DASH with Common Encryption fixed key</td>
      <td style="text-align: left"><code>protection.key</code></td>
      <td style="text-align: left">Encryption key</td>
    </tr>
    <tr>
      <td style="text-align: left">DASH with Common Encryption fixed key</td>
      <td style="text-align: left"><code>protection.keyId</code></td>
      <td style="text-align: left">Key identifier</td>
    </tr>
    <tr>
      <td style="text-align: left">DASH with Common Encryption fixed key</td>
      <td style="text-align: left"><code>protection.widevine.policy</code></td>
      <td style="text-align: left">Policy</td>
    </tr>
    <tr>
      <td style="text-align: left">DASH with Common Encryption fixed key</td>
      <td style="text-align: left"><code>protection.widevine.provider</code></td>
      <td style="text-align: left">Provider name</td>
    </tr>
    <tr>
      <td style="text-align: left">DASH with Common Encryption fixed key</td>
      <td style="text-align: left"><code>protection.playready.licenseAcquisitionUrl</code></td>
      <td style="text-align: left">URL for license acquisition</td>
    </tr>
    <tr>
      <td style="text-align: left">DASH with Common Encryption fixed key</td>
      <td style="text-align: left"><code>protection.playready.licenseUiUrl</code></td>
      <td style="text-align: left">User URL for license check</td>
    </tr>
    <tr>
      <td style="text-align: left">DASH with Common Encryption fixed key</td>
      <td style="text-align: left"><code>protection.playready.domainServiceId</code></td>
      <td style="text-align: left">Domain service ID</td>
    </tr>
  </tbody>
</table>

### Example: override a license acquisition URL

Configure two outputs in the catalog with different **Parameters mapping key** values. Give the first output a license acquisition URL and leave this field empty on the second output. In the packaging service, add a **Key** consisting of the second output’s mapping key followed by `protection.uri`. Set its **Value** to the license acquisition URL for the service.

<table>
  <thead>
    <tr>
      <th style="text-align: left">Output</th>
      <th style="text-align: left">License acquisition URL in the published playlist</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="text-align: left">First output</td>
      <td style="text-align: left">The URL configured on the output.</td>
    </tr>
    <tr>
      <td style="text-align: left">Second output</td>
      <td style="text-align: left">The URL configured on the service.</td>
    </tr>
  </tbody>
</table>
