Using Zencoder with Azure

Zencoder can upload and download files (blobs) from your Azure containers. The account, container, and blob details must be embedded in the URL of job inputs & outputs.

Working with Azure

 

Azure URLs must use the azure://account-name:account-key@container/blob format. The following job request shows how to reference Azure locations for inputs and outputs:

{
    "api_key": "93h630j1dsyshjef620qlkavnmzui3",
    "input": "azure://account-name:account-key@container/file-name.avi",
    "outputs": [
    {
        "url": "azure://account-name:account-key@container/output-file-name.mp4",
        "width": "1280",
        "height": "720"
    }
    ]
}

The account-name and account-key should be CGI escaped. Nothing else should need to be escaped, as with other URLs in Zencoder. They can be found in the Azure management interface. The account-name is the name of the storage account (linked to region, etc). Keys are available from the bottom of the overview screen for the account.

Each Azure account can have multiple containers. The container field in the URL must be defined and configured in Azure before it can be used in a Zencoder job.

The blob field in the URL represents the name of the file. The blob is the only component of the URL that does not need to be configured in advance in Azure.

Azure SAS Token Support

Support for authorizing Azure file transfers is included in Zencoder. Only Account SAS tokens are currently supported, and at least the "sv", "si", "sr" and "sig" parameters are required as part of the token.

Example SAS token:

sv=2019-10-10&si=sas-account&sr=c&sig=as87LKJHab87afjlghKJH654kjmasfRas02fabf34x8%3D

There are two ways to include the SAS token along with an Azure URL:

  • Append the token to the URL as a query string parameter.
  • Provide the token separately with the "azure_sas" setting.

API Request Examples

Input URLs

Query string version
{  "input": "azure://account-name@container/path/to/input.mp4?sv=2019-10-10&si=sas-account&sr=c&sig=as87LKJHab87afjlghKJH654kjmasfRas02fabf34x8%3D"}
Separate parameter version
{  "input": "azure://account-name@container/path/to/input.mp4",  "azure_sas": "sv=2019-10-10&si=sas-account&sr=c&sig=as87LKJHab87afjlghKJH654kjmasfRas02fabf34x8%3D"}

Output URLs

Query string version
{
  "outputs": [
    {
      "url": "azure://account-name@container/path/to/output.mp4?sv=2019-10-10&si=sas-account&sr=c&sig=as87LKJHab87afjlghKJH654kjmasfRas02fabf34x8%3D"
    }
  ]
}
Separate parameter version
{
  "outputs": [
    {
      "url": "azure://account-name@container/path/to/output.mp4",  "azure_sas": "sv=2019-10-10&si=sas-account&sr=c&sig=as87LKJHab87afjlghKJH654kjmasfRas02fabf34x8%3D"
    }
  ]
}

Thumbnail URLs

For thumbnails, the base URL typically doesn't include a filename. As with output URLs, this will be updated in a way that preserves query string parameters that include an SAS token.

Query string version

{
  "outputs": [
    {
      "thumbnails": [
        {
          "label": "my-thumbs",
          "number": 10,
          "base_url": "azure://account-name@container/path/to/thumbs/?sv=2019-10-10&si=sas-account&sr=c&sig=as87LKJHab87afjlghKJH654kjmasfRas02fabf34x8%3D"
        }
      ]
    }
  ]
}

Separate parameter version

{
  "outputs": [
    {
      "thumbnails": [
        {
          "label": "my-thumbs",
          "number": 10,
          "base_url": "azure://account-name@container/path/to/thumbs/",
          "azure_sas": "sv=2019-10-10&si=sas-account&sr=c&sig=as87LKJHab87afjlghKJH654kjmasfRas02fabf34x8%3D"
        }
      ]
    }
  ]
}