[object Object] Icon

Encoding
Learn how to create, start, manage and modify Encodings

[object Object] Icon

Player
Learn how to create, start, manage and modify Players

[object Object] Icon

Analytics
Learn how to create, start, manage and modify Analyticss

Docs Home
User shortcuts for search
Focus by pressing f
Hide results by pressing Esc
Navigate via   keys

Tue Apr 05 2022

Bitmovin CDN Output (Beta)

Tue Apr 05 2022

OverviewLink Icon

The Bitmovin Content Delivery Network (CDN) helps set up your workflows faster by simplifying your content distribution. It’s easy to use and removes the need to set up your own output storage. Your content will be automatically distributed around the globe, enabling fast and efficient delivery to all your viewers without any additional effort.

RequirementsLink Icon

  • SDK Version: 1.111.0 or higher
  • Content-Type: VoD only
  • Available to Bitmovin Accounts created after April 5th, 2022 that have
    • Starter or PAYG subscription
    • ongoing Encoding Trial.

Supported FeaturesLink Icon

  • Simple Encoding API for VoD
  • customized encoding workflows for VoD

Usage in the DashboardLink Icon

The Bitmovin CDN Output is listed in the Outputs overview, where you find your existing Output resources as well. So, you can also use it as an Output destination in Step 6 when you create a new Encoding through the Dashboard:

  1. Go to https://bitmovin.com/dashboard/
  2. On the left, open the "Encoding" section, and select "Encodings"
  3. In the upper right corner of the Overview, click "Create new encoding"
  4. Go through each step and select your Input and all desired renditions and manifests for your encoding.
  5. In step 6, select "CDN" in the Output List encoding-ui-output-list--cdn
  6. In step 7 of the Encoding Wizard, click "Start Encoding", then "Go to Encoding" once the encoding successfully started to open its encoding detail view.
  7. There, select the “Manifests” tab. You will find the CDN URL to your encoded content there. Click the “Preview” button to view in the dashboard right away :slight_smile: encoding-details-manifest-cdn-url

ℹ️ The domain name in this URL is unique to your account. It gets set up the first time you use the CDN as output for an encoding. So, it can take a couple of minutes for its DNS entry to become globally available. As soon as it is reachable, you will be able to play your content as expected.

Usage with the Simple Encoding APILink Icon

This API is the most simple, and easy way to start an encoding today. Using your dedicated CDN Output only requires to provide outputs:[{ type: "CDN" }] in your Simple Encoding API request:

1curl --location --request POST 'https://api.bitmovin.com/v1/encoding/simple/jobs/vod' \
2 --header 'x-api-key: YOUR_BITMOVIN_API_KEY' \
3 --header 'Content-Type: application/json' \
4 --data-raw '{
5 "name": "simple_encoding_name",
6 "encodingTemplate": "H264",
7 "inputs": [
8 {
9 "url": "s3://my-bucket/path/file.mp4",
10 "credentials": {
11 "accessKey": "S3_INPUT_ACCESS_KEY",
12 "secretKey": "S3_INPUT_SECRET_KEY"
13 }
14 }
15 ],
16 "outputs": [
17 {
18 "type": "CDN"
19 }
20 ]
21 }'

Using the Bitmovin SDK for Java (v1.111 or higher), this translates to

1simpleEncodingJob.addOutputsItem(new SimpleEncodingVodJobCdnOutput());

Doing so, you tell the Simple Encoding API to use the Bitmovin CDN Output that is present in your account.

1// define input
2var input = new SimpleEncodingVodJobUrlInput();
3input.setUrl("s3://my-bucket/path/file.mp4");
4
5// input credentials
6var inputCredentials = new SimpleEncodingVodJobAccessKeyCredentials();
7inputCredentials.setAccessKey(S3_INPUT_ACCESS_KEY);
8inputCredentials.setSecretKey(S3_INPUT_SECRET_KEY);
9input.setCredentials(inputCredentials);
10
11// put it all together
12SimpleEncodingVodJobRequest simpleEncodingJob = new SimpleEncodingVodJobRequest();
13simpleEncodingJob.setEncodingTemplate(EncodingTemplate.H264) //or EncodingTemplate.AV1
14simpleEncodingJob.addInputsItem(input);
15// define CDN output
16simpleEncodingJob.addOutputsItem(new SimpleEncodingVodJobCdnOutput());
17
18// call the API to start the Job
19api.simple.jobs.vod.create(simpleEncodingJob);

Usage with the Bitmovin APILink Icon

ℹ️ Take a look at our Getting Started Guide to learn how to use the Bitmovin API to create your first custom encoding workflow.

Using the Bitmovin API, you will have to look up the CDN Output in your account to obtain its ID first to use it in the EncodingOutput Configuration Objets of your encoding workflow. The simplest way to do that is to use the “List CDN Outputs” endpoint:

1CdnOutput cdnOutput = bitmovinApi.encoding.outputs.cdn.list().getItems().get(0);

or, you obtain its details by using its ID. You can look up its ID in the dashboard under “Encoding => Outputs“. Click on the "CDN" Output there to open its detail view, copy its ID, and replace with it yourCdnOutputId in the code snippet below:

1CdnOutput cdnOutput = bitmovinApi.encoding.outputs.cdn.get("yourCdnOutputId");

Output paths for CDN Outputs

When you create an encoding you configure it as you do usually. Once an encoding is started, all EncodingOutput Configuration Objects that refer to CDN Output will be automatically adjusted to meet CDN Output file structure requirements:

  • Every outputPath of an EncodingOutput Configuration Object will be pre-fixed with an Asset ID which is unique within an encoding. Doing so, it is ensured that all resources created by an encoding share the same root folder on your CDN Output.
  • ACL permissions are set to PRIVATE to ensure the content on the CDN storage is only accessible through its attached CDN Endpoint URL.

Obtain the CDN URL for your encoded contents

outputPaths only contain relative URLs. By concatenating the domainName of your CDN Output with those output paths you will obtain the URL to a particular resource on your CDN storage.

ℹ️ The domainName of an CDN Output is only available, after it was used at least once by an successful encoding.

The following example show how you can programmatically obtain the CDN URL for an output of an Progressive MP4 Muxing:

1// retrieve updated CDN output details
2CdnOutput cdnOutput = bitmovinApi.encoding.outputs.cdn.get(cdnOutput.getId())
3
4// retrieve updated muxing details (https://bitmovin.com/docs/encoding/api-reference/all#/Encoding/GetEncodingEncodingsMuxingsByEncodingIdAndMuxingId)
5Mp4Muxing retrievedMuxing =
6 bitmovinApi.encoding.encodings.muxings.mp4.get(encoding.getId(), muxing.getId());
7
8// find the EncodingOutput of the muxing that refers to the CdnOutput (in case there are more than one)
9EncodingOutput cdnEncodingOutput =
10 retrievedMuxing.getOutputs().stream()
11 .filter(encodingOutput -> encodingOutput.getOutputId().equals(cdnOutput.getId())).findFirst().get();
12
13// build the CDN URL
14String pathOnCdn = String.format("https://%s/%s%s", cdnOutput.getDomainName(), cdnEncodingOutput.getOutputPath(), retrievedMuxing.getFilename());

The following example shows how you can programmatically obtain the CDN URL for a Manifest:

1// retrieve updated output details (domainName is only available after the first usage) (https://bitmovin.com/docs/encoding/api-reference/sections/outputs#/Encoding/GetEncodingOutputsCdnByOutputId)
2CdnOutput cdnOutput = bitmovinApi.encoding.outputs.cdn.get(cdnOutput.getId())
3
4// retrieve updated manifest details (https://bitmovin.com/docs/encoding/api-reference/sections/manifests#/Encoding/GetEncodingManifestsDashByManifestId)
5DashManifest retrievedManifest =
6 bitmovinApi.encoding.manifests.dash.get(manifest.getId());
7
8// find the EncodingOutput of the muxing that refers to the CdnOutput (in case there are more than one)
9String manifestOutputPath =
10 retrievedManifest.getOutputs().stream()
11 .filter(encodingOutput -> encodingOutput.getOutputId().equals(cdnOutput.getId()))
12 .findFirst()
13 .map(EncodingOutput::getOutputPath).get();
14
15// build the absolute path
16String pathOnCdn =
17 String.format(
18 "https://%s/%s%s",
19 cdnOutput.getDomainName(),
20 manifestOutputPathOptional.get(),
21 manifest.getManifestName());

Known LimitationsLink Icon

  • When using the Bitmovin CDN Output for the first time, it can take a couple of minutes until the necessary DNS entries for your CDN are propagated. The storage for your CDN is immediately available.
  • Only automatically generated manifests that are created as part of the Encoding Start Request, can be used when using the Bitmovin CDN Output.
  • Live Encodings don’t support the Bitmovin CDN Output at the moment.

Give us feedback