Adaptive Bitrate Packaging

Package

An output package is a group of containers each representing an Adaptive Bitrate (ABR) variant. Media streams are routed from the input containers to the variant containers in the output package.

For example the following composition creates an HTTP Live Streaming (HLS) package with two variant containers hi and lo:

---
input:
  container:
  - name: 360p
    video:
    - name: v1
  - name: 720p
    video:
    - name: v2
  - name: aac
    audio:
    - name: a1
output:
  package:
  - name: output1
    type: 'hls '
    properties:
      SegmentDuration: 10.0
    container:
    - name: lo
      type: 'mpg2'
      video:
      - name: v1
      audio:
      - name: a1
    - name: hi
      type: 'mpg2'
      video:
      - name: v2
      audio:
      - name: a1
{
  "input": {
    "container": [
      {
        "name": "360p",
        "video": [
          {
            "name": "v1"
          }
        ]
      },
      {
        "name": "720p",
        "video": [
          {
            "name": "v2"
          }
        ]
      },
      {
        "name": "aac",
        "audio": [
          {
            "name": "a1"
          }
        ]
      }
    ]
  },
  "output": {
    "package": [
      {
        "name": "output1",
        "type": "hls ",
        "properties":{  
                    "SegmentDuration": 10   
                },
        "container": [
          {
            "name": "lo",
            "type": "mpg2",
            "video": [
              {
                "name": "v1"
              }
            ],
            "audio": [
              {
                "name": "a1"
              }
            ]
          },
          {
            "name": "hi",
            "type": "mpg2",
            "video": [
              {
                "name": "v2"
              }
            ],
            "audio": [
              {
                "name": "a1"
              }
            ]
          }
        ]
      }
    ]
  }
}

Note that this example simply re-packages the encoded v1, v2 and a1 input streams.

Supported Formats

Transform supports most common ABR package formats. Each type of package supports different variant container formats, encryption algorithms and DRM protection systems.

See the Package Reference page for additional details.

Path Templates

A package produces multiple output files. The file paths for a package are specified using a template dictionary. Each entry has a name and a corresponding path template. Template names are defined for each package type.

For example the following composition provides a template dictionary for an HLS package. In this case the path property sets the parent directory. Sub-directories can be created with the / character.

---
output:
  package:
  - type: 'hls '
    name: output1
    path: "$job_id$"
    template:
    - name: key
      path: "$kid$.bin"
    - name: manifest
      path: "$package$.m3u8"
    - name: playlist
      path: "$container$/$container$.m3u8"
    - name: media
      path: "$container$/$container$_$segment$.$extension$"
    container:
    - name: lo
    - name: hi
{
   "output": {
      "package": [
         {
            "type": "hls ",
            "name": "output1",
            "path":"$job_id$",
            "template": [
               {
                  "name": "key",
                  "path": "$kid$.bin"
               },
               {
                  "name": "manifest",
                  "path": "$package$.m3u8"
               },
               {
                  "name": "playlist",
                  "path": "$container$/$container$.m3u8"
               },
               {
                  "name": "media",
                  "path": "$container$/$container$_$segment$.$extension$"
               }
            ],
            "container": [
               {
                  "name": "lo"
               },
               {
                  "name": "hi"
               }
            ]
         }
      ]
   }
}

Stream Encoding

In a typical package the media streams are encoded at different resolutions and bit rates, for example:

---
input:
  container:
  - name: input1
    video:
    - name: v1
output:
  package:
  - name: output1
    type: 'hls '
    properties:
      SegmentDuration: 3
    container:
    - name: lo
      type: mpg2
      video:
      - route:
          name: v1
        width: 640
        height: 480
        encode:
          type: h264
          properties:
            BitRate: 500000
    - name: hi
      type: mpg2
      video:
      - route:
          name: v1
        width: 1280
        height: 720
        encode:
          type: h264
          properties:
            BitRate: 1000000
{
   "input": {
      "container": [
         {
            "name": "input1",
            "video": [
               {
                  "name": "v1"
               }
            ]
         }
      ]
   },
   "output": {
      "package": [
         {
            "name": "output1",
            "type": "hls ",
            "properties":{  
                            "SegmentDuration": 3
                        },
            "container": [
               {
                  "name": "lo",
                  "type": "mpg2",
                  "video": [
                     {
                        "route": {
                           "name": "v1"
                        },
                        "width": 640,
                        "height": 480,
                        "encode": {
                           "type": "h264",
                             "properties": {
                                            "BitRate": 500000
                                         }
                        }
                     }
                  ]
               },
               {
                  "name": "hi",
                  "type": "mpg2",
                  "video": [
                     {
                        "route": {
                           "name": "v1"
                        },
                        "width": 1280,
                        "height": 720,
                        "encode": {
                           "type": "h264",
                             "properties": {
                                            "BitRate": 1000000
                                         }
                        }
                     }
                  ]
               }
            ]
         }
      ]
   }
}

Stream Replication

A media stream (typically audio) can be encoded and routed to multiple variant containers, for example:

---
input:
  container:
  - name: input1
    video:
    - name: v1
    audio:
    - name: a1
output:
  package:
  - name: output1
    type: 'hls '
    properties:
      SegmentDuration: 3
    audio:
    - name: a2
      route:
        name: a1
      encode:
        type: mcac
        properties:
          BitRate: 128000
    container:
    - name: lo
      type: mpg2
      video:
      - route:
          name: v1
        width: 640
        height: 480
        encode:
          type: h264
          properties:
            BitRate: 500000
      audio:
      - route:
          name: a2
    - name: hi
      type: mpg2
      video:
      - route:
          name: v1
        width: 1280
        height: 720
        encode:
          type: h264
          properties:
            BitRate: 1000000
      audio:
      - route:
          name: a2
{
   "input":{
      "container":[
         {
            "name":"input1",
            "video":[
               {
                  "name":"v1"
               }
            ],
            "audio":[
               {
                  "name":"a1"
               }
            ]
         }
      ]
   },
   "output":{
      "package":[
         {
            "name":"output1",
            "type":"hls ",
            "properties":{
               "SegmentDuration":3
            },
            "audio":[
               {
                  "name":"a2",
                  "route":{
                     "name":"a1"
                  },
                  "encode":{
                     "type":"mcac",
                     "properties":{
                        "BitRate":128000
                     }
                  }
               }
            ],
            "container":[
               {
                  "name":"lo",
                  "type":"mpg2",
                  "video":[
                     {
                        "route":{
                           "name":"v1"
                        },
                        "width":640,
                        "height":480,
                        "encode":{
                           "type":"h264",
                           "properties":{
                              "BitRate":500000
                           }
                        }
                     }
                  ],
                  "audio":[
                     {
                        "route":{
                           "name":"a2"
                        }
                     }
                  ]
               },
               {
                  "name":"hi",
                  "type":"mpg2",
                  "video":[
                     {
                        "route":{
                           "name":"v1"
                        },
                        "width":1280,
                        "height":720,
                        "encode":{
                           "type":"h264",
                           "properties":{
                              "BitRate":1000000
                           }
                        }
                     }
                  ],
                  "audio":[
                     {
                        "route":{
                           "name":"a2"
                        }
                     }
                  ]
               }
            ]
         }
      ]
   }
}

Digital Rights Management (DRM)

A composition is protected by applying encryption to each output package using one or more encryption keys.

Each encryption key has a unique public id and a private value. The key identifier is assigned by the DRM provider when a key is created. A protection system allows a player to securely request the key from the DRM provider.

For example the following composition is encrypted using a single key and protected using both Microsoft PlayReady and Google Widevine:

output:
  package:
  - type: 'dash'
    encryption:
      key:
      - id: a9f4d51bf8d342c78de5ebeb2b6c512e
        value: 1809764c9860ea32ab370242ac130002
      protection:
      - type: 'play'
      - type: 'vine'
    container:
    - type: 'mpg4'
      encryption:
        key:
        - id: a9f4d51bf8d342c78de5ebeb2b6c512e
{
  "output": {
    "package": [
      {
        "type": "dash",
        "encryption": {
          "key": [
            {
              "id": "a9f4d51bf8d342c78de5ebeb2b6c512e",
              "value": "1809764c9860ea32ab370242ac130002"
            }
          ],
          "protection": [
            {
              "type": "play"
            },
            {
              "type": "vine"
            }
          ]
        },
        "container": [
          {
            "type": "mpg4",
            "encryption": {
              "key": [
                {
                  "id": "a9f4d51bf8d342c78de5ebeb2b6c512e"
                }
              ]
            }
          }
        ]
      }
    ]
  }
}

Did this page help you?