Skip to content

teejas/bitmovin-api-sdk-examples

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bitmovin API SDK Examples Header

This repository provides examples demonstrating usage of the
Bitmovin API SDKs in different programming languages.

License

💡 Getting started

You'll need an active Bitmovin API key for these examples to work.

Don't have an account yet? Sign up for a free Bitmovin trial plan!

If you are new to the topic, we suggest reading our tutorial Understanding the Bitmovin Encoding Object Model to get a basic idea of the building blocks that make up an encoding.

For instructions how to set up the configuration environment and run examples, consult the README.md file in the subfolder for your preferred programming language.

For full documentation of all available API endpoints, see the Bitmovin API reference.

Overview


Fixed Bitrate Ladder Encoding

C# - Java - TS/JS - PHP - Python

This example demonstrates how to create multiple MP4 renditions in a single encoding, using a fixed resolution- and bitrate ladder.

Required configuration parameters:

  • BITMOVIN_API_KEY (?)
  • HTTP_INPUT_HOST (?)
  • HTTP_INPUT_FILE_PATH (?)
  • S3_OUTPUT_BUCKET_NAME (?)
  • S3_OUTPUT_ACCESS_KEY (?)
  • S3_OUTPUT_SECRET_KEY (?)
  • S3_OUTPUT_BASE_PATH (?)

Generating Default Manifests

C# - Java - TS/JS - PHP - Python

This example demonstrates how to create basic DASH and HLS manifests based on a previously configured encoding. Default manifests will try include all the encoding's features that are supported by the respective manifest type.

Required configuration parameters:

  • BITMOVIN_API_KEY (?)
  • HTTP_INPUT_HOST (?)
  • HTTP_INPUT_FILE_PATH (?)
  • S3_OUTPUT_BUCKET_NAME (?)
  • S3_OUTPUT_ACCESS_KEY (?)
  • S3_OUTPUT_SECRET_KEY (?)
  • S3_OUTPUT_BASE_PATH (?)

Per-Title Encoding

C# - Java - TS/JS - PHP - Python

This example shows how to do a Per-Title encoding with default manifests. A Per-Title encoding automatically detects the optimal codec settings for your video assets.

Visit https://bitmovin.com/per-title-encoding/ to get an insight what Per-Title encoding is and how it works.

Required configuration parameters:

  • BITMOVIN_API_KEY (?)
  • HTTP_INPUT_HOST (?)
  • HTTP_INPUT_FILE_PATH (?)
  • S3_OUTPUT_BUCKET_NAME (?)
  • S3_OUTPUT_ACCESS_KEY (?)
  • S3_OUTPUT_SECRET_KEY (?)
  • S3_OUTPUT_BASE_PATH (?)

Multi Codec Encoding

C# - Java - TS/JS - PHP - Python

This example demonstrates how to use different codecs and muxing types in a single encoding.

Required configuration parameters:

  • BITMOVIN_API_KEY (?)
  • HTTP_INPUT_HOST (?)
  • HTTP_INPUT_FILE_PATH (?)
  • S3_OUTPUT_BUCKET_NAME (?)
  • S3_OUTPUT_ACCESS_KEY (?)
  • S3_OUTPUT_SECRET_KEY (?)
  • S3_OUTPUT_BASE_PATH (?)

Multi-language Broadcast TS Encoding

C# - Java - TS/JS - PHP - Python

This example demonstrates how multiple audio streams can be included in a BroadcastTS muxing. BroadcastTS muxings are MPEG transport stream muxings which allow setting custom properties such as PCR interval and PIDs for transmission to traditional broadcast targets like set top boxes, QAM streamers and similar devices. This muxing is not generally used for streaming to IP devices such as browsers, iOS, or Android devices.

Required configuration parameters:

  • BITMOVIN_API_KEY (?)
  • HTTP_INPUT_HOST (?)
  • HTTP_INPUT_FILE_PATH (?)
  • S3_OUTPUT_BUCKET_NAME (?)
  • S3_OUTPUT_ACCESS_KEY (?)
  • S3_OUTPUT_SECRET_KEY (?)
  • S3_OUTPUT_BASE_PATH (?)

Applying Filters

C# - Java - TS/JS - PHP - Python

This example demonstrates how to apply filters to a video stream. Filters will manipulate the content of a stream, e.g. remove noise or add a watermark image. See the Encoding Filters API Reference for a complete list of available filters.

Required configuration parameters:

  • BITMOVIN_API_KEY (?)
  • HTTP_INPUT_HOST (?)
  • HTTP_INPUT_FILE_PATH (?)
  • S3_OUTPUT_BUCKET_NAME (?)
  • S3_OUTPUT_ACCESS_KEY (?)
  • S3_OUTPUT_SECRET_KEY (?)
  • S3_OUTPUT_BASE_PATH (?)
  • WATERMARK_IMAGE_PATH (?)
  • TEXT_FILTER_TEXT (?)

Applying CENC DRM Content Protection

C# - Java - TS/JS - PHP - Python

This example shows how DRM content protection can be applied to a fragmented MP4 muxing. DRM is used to prevent playback on unauthorized devices (piracy) and requires integration with a key server.
The encryption is configured to be compatible with both FairPlay and Widevine, using the MPEG Common Encryption standard.

Required configuration parameters:

  • BITMOVIN_API_KEY (?)
  • HTTP_INPUT_HOST (?)
  • S3_OUTPUT_BUCKET_NAME (?)
  • S3_OUTPUT_ACCESS_KEY (?)
  • S3_OUTPUT_SECRET_KEY (?)
  • S3_OUTPUT_BASE_PATH (?)
  • DRM_KEY (?)
  • DRM_FAIRPLAY_IV (?)
  • DRM_FAIRPLAY_URI (?)
  • DRM_WIDEVINE_KID (?)
  • DRM_WIDEVINE_PSSH (?)

Server-Side Ad Insertion (SSAI)

C# - Java - TS/JS - PHP - Python

This example demonstrates how to create multiple fMP4 renditions with Server Side Ad Insertion (SSAI).

Required configuration parameters:

  • BITMOVIN_API_KEY (?)
  • HTTP_INPUT_HOST (?)
  • HTTP_INPUT_FILE_PATH (?)
  • S3_OUTPUT_BUCKET_NAME (?)
  • S3_OUTPUT_ACCESS_KEY (?)
  • S3_OUTPUT_SECRET_KEY (?)
  • S3_OUTPUT_BASE_PATH (?)

RTMP Live Encoding

C# - Java - TS/JS - PHP - Python

This example shows how to configure and start a live encoding using default DASH and HLS manifests. For more information see: https://bitmovin.com/live-encoding-live-streaming

Required configuration parameters:

  • BITMOVIN_API_KEY (?)
  • S3_OUTPUT_BUCKET_NAME (?)
  • S3_OUTPUT_ACCESS_KEY (?)
  • S3_OUTPUT_SECRET_KEY (?)
  • S3_OUTPUT_BASE_PATH (?)

Batch Encoding

C# - Java - TS/JS - PHP - Python

This example demonstrates how to efficiently execute a large batch of encodings in parallel. In order to keep the startup time for each encoding to a minimum, it is advisable to constantly have some encodings queued. Encodings will therefore be started in a way to maintain a constant queue size.

Required configuration parameters:

  • BITMOVIN_API_KEY (?)
  • HTTP_INPUT_HOST (?)
  • S3_OUTPUT_BUCKET_NAME (?)
  • S3_OUTPUT_ACCESS_KEY (?)
  • S3_OUTPUT_SECRET_KEY (?)
  • S3_OUTPUT_BASE_PATH (?)

Configuration Parameters

These are the parameters that need to be supplied for the examples to work. They can be defined in a file, set as environment variables or passed directly to the run-example script.

Note! See the README.md of the API SDK examples in your preferred programming language on how to configure parameters.

BITMOVIN_API_KEY - Your API key for the Bitmovin API

HTTP_INPUT_HOST - The Hostname or IP address of the HTTP server hosting your input files
Example: my-storage.biz

HTTP_INPUT_FILE_PATH - The path to your input file on the HTTP host
Example: videos/1080p_Sintel.mp4

S3_OUTPUT_BUCKET_NAME - The name of your S3 output bucket
Example: my-s3-bucket-name

S3_OUTPUT_ACCESS_KEY - The access key of your S3 output bucket
Example: AKIAIOSFODNN7EXAMPLE

S3_OUTPUT_SECRET_KEY - The secret key of your S3 output bucket
Example: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

S3_OUTPUT_BASE_PATH - The base path on your S3 output bucket where content will be written
Example: /outputs

WATERMARK_IMAGE_PATH - The path to the watermark image
Example: http://my-storage.biz/logo.png

TEXT_FILTER_TEXT - The text to be displayed by the text filter

DRM_KEY - 16 byte encryption key, represented as 32 hexadecimal characters
Example: cab5b529ae28d5cc5e3e7bc3fd4a544d

DRM_FAIRPLAY_IV - 16 byte initialization vector, represented as 32 hexadecimal characters
Example: 08eecef4b026deec395234d94218273d

DRM_FAIRPLAY_URI - URI of the licensing server
Example: skd://userspecifc?custom=information

DRM_WIDEVINE_KID - 16 byte encryption key id, represented as 32 hexadecimal characters
Example: 08eecef4b026deec395234d94218273d

DRM_WIDEVINE_PSSH - Base64 encoded PSSH payload
Example: QWRvYmVhc2Rmc2FkZmFzZg==

You may also add your own parameters in your configuration. The ConfigProvider class in each example offers a generic function to get the value of the parameter by its name.

About

Set of encoding workflow examples highlighting the use of the Bitmovin API SDKs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 27.4%
  • C# 21.4%
  • PHP 18.0%
  • Python 17.2%
  • TypeScript 15.9%
  • Shell 0.1%