Look at the encoding job samples if you want to know how the encoding job requests look like. You can use these job requests with the Encoding API that Axinom Encoding Service exposes.

Encoding Job Samples

This document gives you some samples of Encoding job requests. You can send the following job requests to the Encoding job API which is related to your Axinom Encoding tenant. As an example, you can send the job request to the encoding API at https://vip-eu-west-1.axinom.com/. You can find the descriptions about endpoints from the Encoding API page.

You can use your storages to pass the input and output content to the Encoding job. In the following examples, we have sample Encoding jobs with AWS and Azure. Read more about storage providers to get an idea about the storage providers you can use.

Encoding Job with AWS

Below, you can find Encoding job requests created using AWS S3 bucket as the storage and AWS SQS as the message publisher. Note that you have to create your own AWS S3 bucket to store your content. You can use the Amazon S3 console, Amazon S3 APIs, AWS CLI, or AWS SDKs to create a bucket. Moreover, you need a SQS target queue to capture the messages related to each event while running the Encoding job. You can use the Amazon SQS console to create standard queues and FIFO queues. Then, you can see the messages in the queue with the message type of each event.

Read more about the need of message queues on the message publishers page.

Below, sample job requests are created under the assumption that your Input and Output are saved into the same S3 bucket, separated by folder.

Simple Encoding Job

This is a simple encoding job request with only the mandatory fields, which need to be supplied to run a successful Encoding job. In this Encoding job request, DRM protection is not used. We’ll assume that the video stored in S3 bucket is a mp4 file with embedded audio. Also, the output is in default bitrates and in the H264 format.

Note
If we assume that the input video is inside the movie/movie_name folder inside the S3 bucket, the uriPath should be: "https://<your_bucket-name>.s3.us-east-2.amazonaws.com/<movie>/<movie_name>/"
{
    "ExternalId": "<job_reference_id>",
    "ExternalType": "movie",
    "ContentAcquisition": {
        "Provider": "AmazonS3",
        "UriPath": "https://<your_bucket-name>.s3.us-east-2.amazonaws.com/<input-folder-path>/",
        "CredentialsName": "<YOUR_AWS_ACCESS_KEY_ID>",
        "CredentialsSecret": "<YOUR_AWS_SECRET_ACCESS_KEY>"
    },
    "MediaMappings": {
        "VideoStreamExpression": "^.*\\.(mp4)$"
    },
    "ContentProcessing": {
        "OutputFormat": ["Cmaf"]
    },
    "ContentPublishing": {
        "Provider": "AmazonS3",
        "UriPath": "https://<your_bucket-name>.s3.us-east-2.amazonaws.com/<output-folder-path>/",
        "CredentialsName": "<YOUR_AWS_ACCESS_KEY_ID>",
        "CredentialsSecret": "<YOUR_AWS_SECRET_ACCESS_KEY>"
    },
    "MessagePublishers": [
        {
            "Type": "AmazonSqs",
            "UriPath": "https://sqs.us-east-2.amazonaws.com/<your_account-id>/<your_Queue-path>",
            "CredentialsName": "<YOUR_AWS_ACCESS_KEY_ID>",
            "CredentialsSecret": "<YOUR_AWS_SECRET_ACCESS_KEY>"
        }
    ]
}

More Complex Encoding Job

This is a sample encoding job request created using more attributes to access more features of the Encoding API. We use the "DRMProtection" attribute for the Direct Mode. Currently, we are using separate video, audio tracks, and subtitle files in the Encoding job request.

DRM protection possibilities are described on the DRM Protection page.

You can find lists of predefined bitrates for specific aspect ratios under default bitrates and add more ratios to the video representations attributes.

Note
We encourage you to encrypt the AWS credentials as explained under Credentials Protection.
{
    "ExternalId": "<job_reference_id>",
    "ExternalType": "movie",
    "ContentAcquisition": {
        "Provider": "AmazonS3",
        "UriPath": "https://<your_bucket-name>.s3.us-east-2.amazonaws.com/<input-folder-path>/",
        "CredentialsName": "<YOUR_AWS_ACCESS_KEY_ID>",
        "CredentialsSecret": "<ENCRYPTED_AWS_SECRET_ACCESS_KEY>",
        "CredentialsProtection": "Encrypted"
    },
    "MediaMappings": {
        "VideoStreamExpression": "^.*\\.(mp4|avi|mov)$",
        "AudioFileLanguageExpression": "^audio-([a-zA-Z0-9\\-]+).mp3$",
        "SubtitleFileLanguageExpression": "^subtitle-([a-zA-Z0-9\\-]+).(vtt|ttml|srt)$",
        "CaptionFileLanguageExpression": "^caption-([a-zA-Z0-9\\-]+).(vtt|ttml|srt)$"
    },
    "ContentProcessing": {
        "OutputFormat": ["Cmaf"],
        "VideoFormat": "H264",
        "OptimizeFor": "Balance",
        "DrmProtection": "CertificateEncryptedBase64Key",
        "ContentKey": "<CONTENT_KEY_ENCRYPTED_WITH_ENCODING_SERVICE_CERTIFICATE>",
        "KeyID":"<KEY_ID>",
        "DeleteFilesFromSourceWhenDone": "False",
        "VideoRepresentations": [
            {
                "Width": 1280,
                "Height": 720,
                "BitrateInKbps": 1500
            },
            {
                "Width": 852,
                "Height": 480,
                "BitrateInKbps": 800
            }
        ]
    },
    "ContentPublishing": {
        "Provider": "AmazonS3",
        "UriPath": "https://<your-bucket-name>.s3.us-east-2.amazonaws.com/<output-folder-path>/",
        "CredentialsName": "<YOUR_AWS_ACCESS_KEY_ID>",
        "CredentialsSecret": "<ENCRYPTED_AWS_SECRET_ACCESS_KEY>",
        "CredentialsProtection": "Encrypted"
    },
    "MessagePublishers": [
        {
            "Type": "AmazonSqs",
            "UriPath": "https://sqs.us-east-2.amazonaws.com/account-id/<your_Queue-name>",
            "CredentialsName": "<YOUR_AWS_ACCESS_KEY_ID>",
            "CredentialsSecret": "<ENCRYPTED_AWS_SECRET_ACCESS_KEY>",
            "CredentialsProtection": "Encrypted"
        }
    ]
}

Encoding Job with Azure

The example below is also the same as the simple AWS example above. Here, we use an Azure storage account to store content and Azure service bus as the message publisher. You can also use the features we mentioned in the AWS advanced example for the example below.

You need your own Azure Storage Account and an Azure Bus service. You can create them using the Azure portal, Azure PowerShell, Azure CLI, or an Azure Resource Manager template.

The endpoint for the message publisher contains the details of the Azure Service Bus. To capture the messages through the Azure Service Bus, you need to create queues for each message type as listed in the events list. Then Axinom Encoding API pushes messages to each queue related to the event.

E.g., for the "JobSuccess", you need to create a queue named "jobsuccessqueue". When a "jobsuccess" event is happening, the messages related to the event are pushed to the "jobsuccessqueue". Learn more about creating Azure Service Bus queues from the Azure guide.

You can monitor job progress by listening to the queue you created.

{
    "ExternalId": "<job_reference_id>",
    "ExternalType": "movie",
    "ContentAcquisition": {
        "Provider": "AzureBlob",
        "UriPath": "https://<storage_accout_name>.blob.core.windows.net/<container_name>/<input_folder_path>",
        "CredentialsName": "<STORAGE_ACCOUNT_NAME>",
        "CredentialsSecret": "<SHARED_KEY>"
    },
    "MediaMappings": {
        "VideoStreamExpression": "^.*\\.(mp4)$"
    },
    "ContentProcessing": {
        "OutputFormat": ["Cmaf"]
    },
    "ContentPublishing": {
        "Provider": "AzureBlob",
        "UriPath": "https://<storage_accout_name>.blob.core.windows.net/<container_name>/<output_folder_path>",
        "CredentialsName": "<STORAGE_ACCOUNT_NAME>",
        "CredentialsSecret": "<SHARED_KEY>"
    },
    "MessagePublishers": [
        {
            "Type": "azureservicebusqueue",
            "Connection": "Endpoint=sb://<azure_service_bus_name>.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=<your_secret_key>"
        }
    ]
}

Revision History

The table below outlines the document versions and any changes between them.

Version Date Description

1.0

May 11, 2021

  • Initial version.

1.1

June 25, 2021

  • Some more details for Azure.