CAE Fast Publish

Context Aware Encoding (CAE) yields great renditions, but analyzing the source video adds time to processing. If getting new videos online as quickly as possible is a high priority for you, the fast publish option described in this document allows you to publish videos quickly while still taking advantage of CAE.

Introduction

Fast publish allows you to use CAE and still get videos online as quickly as possible by creating one or more temporary renditions which can be played immediately. The following conditions then apply:

  • As soon as dynamic renditions are available, they will be used rather than the temporary rendition(s) for playback
  • At some point after all the dynamic renditions have been processed, the temporary rendition(s) will be deleted automatically

Requirements

In order to use fast publish, you must:

  1. Have an account enabled for Dynamic Delivery
  2. Have the account enabled for CAE
  3. Create a custom CAE ingest profile using the Ingest Profiles API (instructions below)

Custom profile for fast publish

Creating a custom profile enabled for fast publish is straightforward. It looks like a regular CAE profile, with one difference: in addition to a renditions array, the dynamic_origin object will contain a temporary_renditions array containing one or more fast publish renditions.

The fast publish renditions are specified by name and must come from the list below (the number following video or audio is the target bitrate for the rendition). You can include audio-only renditions in addition to video renditions if you like.

Since the point of fast publish is to make a rendition available for playback as quickly as possible, it probably makes sense to use a low to mid-range bitrate for at least one of the temporary renditions.

Steps for creating a custom profile

Here are the steps for creating a custom fast publish profile with one temporary rendition. In the steps below, we will use the multi-platform-standard-dynamic standard profile as the basis for the custom profile, but you can use any of the CAE profiles.

Get client credentials for the Ingest Profiles API

  1. Login to Studio and go to the API Authentication section under Admin (you must be an Admin or get an Admin on the account to do this)
  2. Click Register New Application to create a new set of client credentials.
  3. Select the appropriate account(s) and at least these permissions for the credentials:
    Ingestion Profiles Permissions
    Ingestion Profiles Permissions
  4. Save the Client ID and Client Secret as you will need them for later steps.

Create the JSON for the custom profile

  1. Copy the JSON below (for the multi-platform-standard-dynamic profile) into a text editor:
    {
      "name": "multi-platform-standard-dynamic",
      "display_name": "Multiplatform Standard (CAE)",
      "description": "Deliver a wide range of content types across a variety of platforms on mobile and desktop.",
      "account_id": YOUR_ACCOUNT_ID,
      "digital_master": {
        "rendition": "passthrough",
        "distribute": false
      },
      "renditions": [],
      "packages": [],
      "dynamic_origin": {
        "renditions": [
          "default/audio64",
          "default/audio128",
          "default/audio96"
        ],
        "images": [
          {
            "label": "thumbnail",
            "height": 90,
            "width": 160
          },
          {
            "label": "poster",
            "height": 720,
            "width": 1280
          }
        ],
        "dynamic_profile_options": {
          "min_renditions": 2,
          "max_renditions": 6,
          "min_resolution": {
            "width": 320,
            "height": 180
          },
          "max_resolution": {
            "width": 1280,
            "height": 720
          },
          "max_frame_rate": 30,
          "max_bitrate": 2400,
          "max_first_rendition_bitrate": 250,
          "keyframe_rate": 0.5,
          "select_baseline_profile_configuration": true
        }
      }
    }
  2. Change the following values:
    • name: "multi-platform-standard-dynamic-fast-publish"
    • display_name: "Fast Publish Standard (CAE)"
    • account_id: "YOUR_ACCOUNT_ID"
  3. After the dynamic_origin>renditions array, add the following array:
    "temporary_renditions": [
      {"name": "default/video450"},
      {"name": "default/video700"},
      {"name": "default/video900"}
    ]
  4. The full JSON for your custom profile should now look like this:
    {
      "name": "multi-platform-standard-dynamic-fast-publish",
      "display_name": "Fast Publish Standard (CAE)",
      "description": "Deliver a wide range of content types across a variety of platforms on mobile and desktop.",
      "account_id": "account_id",
      "digital_master": {
        "rendition": "passthrough",
        "distribute": false
      },
      "renditions": [],
      "packages": [],
      "dynamic_origin": {
        "renditions": [
          "default/audio64",
          "default/audio128",
          "default/audio96"
        ],
        "temporary_renditions": [
          {"name": "default/video450"},
          {"name": "default/video700"},
          {"name": "default/video900"}
        ],
        "images": [
          {
            "label": "thumbnail",
            "height": 90,
            "width": 160
          },
          {
            "label": "poster",
            "height": 720,
            "width": 1280
          }
        ],
        "dynamic_profile_options": {
          "min_renditions": 2,
          "max_renditions": 6,
          "min_resolution": {
            "width": 320,
            "height": 180
          },
          "max_resolution": {
            "width": 1280,
            "height": 720
          },
          "max_frame_rate": 30,
          "max_bitrate": 2400,
          "max_first_rendition_bitrate": 250,
          "keyframe_rate": 0.5,
          "select_baseline_profile_configuration": true
        }
      }
    }

Add the custom profile to your account

Now we will use the Ingest Profiles API to add the custom profile to your account.

Getting access tokens

Each API request needs to be authenticated using an access token (you will see exactly how in later steps).

  1. You will need to get an access token from:
        https://oauth.brightcove.com/v4/access_token
  2. If you are using Insomnia or Postman, then you can set up OAuth2 authentication using the instructions in the linked documents to have them fetch the access tokens for you.
  3. If you are using cURL, here is a cURL command you can use to get an access token - you will need to replace the ENCODED_AUTHENTICATION_STRING with a Base64-encoded string consisting of your client_id:client_secret:
        curl --request POST \
          --url 'https://oauth.brightcove.com/v4/access_token?grant_type=client_credentials' \
          --header 'Authorization: Basic ENCODED_AUTHENTICATION_STRING' \
          --header 'Content-Type: application/x-www-form-urlencoded'
  4. Note that access tokens expire after 5 minutes - if that happens, just get a new one (Insomnia will get one for you automatically when it's needed).
Add the custom ingest profile
  1. If you are using Insomnia or Postman, set up a new POST request to:
        https://ingestion.api.brightcove.com/v1/accounts/account_id/profiles

    The request body will be the JSON for the custom profile you created earlier.

    Include a Content-Type: application/json header

    Set up OAuth2 authentication according to the instructions in the guides to using Insomnia or Postman.

  2. If you are using cURL, you can use the following request, replacing the account_id and access token values with your own:
        curl --request POST \
          --url https://ingestion.api.brightcove.com/v1/accounts/57838016001/profiles \
          --header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
          --header 'content-type: application/json' \
          --data '{
          "name": "multi-platform-standard-dynamic-fast-publish",
          "display_name": "Fast Publish Standard (CAE)",
          "description": "Deliver a wide range of content types across a variety of platforms on mobile and desktop.",
          "account_id": "YOUR_ACCOUNT_ID",
          "digital_master": {
            "rendition": "passthrough",
            "distribute": false
          },
          "renditions": [],
          "packages": [],
          "dynamic_origin": {
            "renditions": [
              "default/audio64",
              "default/audio128",
              "default/audio96"
            ],
            "temporary_renditions": [
              {"name": "default/video450"},
              {"name": "default/video700"},
              {"name": "default/video900"}
            ],
            "images": [
              {
                "label": "thumbnail",
                "height": 90,
                "width": 160
              },
              {
                "label": "poster",
                "height": 720,
                "width": 1280
              }
            ],
            "dynamic_profile_options": {
              "min_renditions": 2,
              "max_renditions": 6,
              "min_resolution": {
                "width": 320,
                "height": 180
              },
              "max_resolution": {
                "width": 1280,
                "height": 720
              },
              "max_frame_rate": 30,
              "max_bitrate": 2400,
              "max_first_rendition_bitrate": 250,
              "keyframe_rate": 0.5,
              "select_baseline_profile_configuration": true
            }
          }
        }'
  3. After you send the request, you should see your new profile echoed back to you in the response.

Notifications

When fast publish temporary renditions are created, you will receive DYNAMIC_RENDITION "CREATE" notifications just as you do for the regular renditions:

    {
      "entity": "contextAwareEncoding5",
      "entityType": "DYNAMIC_RENDITION",
      "version": "1",
      "action": "CREATE",
      "jobId": "413a9938-6d73-478c-b4d9-fdeb45927a4b",
      "videoId": "5600255921001",
      "dynamicRenditionId": "contextAwareEncoding5",
      "bitrate": 364,
      "width": 512,
      "height": 384,
      "accountId": "1910141566001",
      "status": "SUCCESS"
    }
    

A new notification will be sent when a temporary rendition has been deleted:

    {
      "entity": "fastpublishRendition1",
      "entityType": "DYNAMIC_RENDITION",
      "version": "1",
      "action": "DELETE",
      "jobId": "413a9938-6d73-478c-b4d9-fdeb45927a4b",
      "videoId": "5600255921001",
      "dynamicRenditionId": "fastpublishRendition1",
      "accountId": "1910141566001",
      "status": "SUCCESS"
    }