Using the C++ Producer Library - Amazon Kinesis Video Streams
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Using the C++ Producer Library

You can use the Amazon Kinesis Video Streams provided C++ Producer Library to write application code to send media data from a device to a Kinesis video stream.

Object model

The C++ library provides the following objects to manage sending data to a Kinesis video stream:

  • KinesisVideoProducer: Contains information about your media source and Amazon credentials, and maintains callbacks to report on Kinesis Video Streams events.

  • KinesisVideoStream: Represents the Kinesis video stream. Contains information about the video stream's parameters, such as name, data retention period, and media content type.

Putting media into the stream

You can use the C++ library provided methods (for example, PutFrame) to put data into the KinesisVideoStream object. The library then manages the internal state of the data, which can include the following tasks:

  • Performing authentication.

  • Watching for network latency. If the latency is too high, the library might choose to drop frames.

  • Tracking status of streaming in progress.

Callback interfaces

This layer exposes a set of callback interfaces, which enable it to talk to the application layer. These callback interfaces include the following:

  • Service callbacks interface (CallbackProvider): The library invokes events obtained through this interface when it creates a stream, obtains a stream description, and deletes a stream.

  • Client-ready state or low storage events interface (ClientCallbackProvider): The library invokes events on this interface when the client is ready, or when it detects that it might run out of available storage or memory.

  • Stream events callback interface (StreamCallbackProvider): The library invokes events on this interface when stream events occur, such as the stream entering the ready state, dropped frames, or stream errors.

Kinesis Video Streams provides default implementations for these interfaces. You can also provide your own custom implementation—for example, if you need custom networking logic or you want to expose a low storage condition to the user interface.

For more information about callbacks in the Producer Libraries, see Producer SDK callbacks.

Procedure: Using the C++ Producer SDK

This procedure demonstrates how to use the Kinesis Video Streams client and media sources in a C++ application to send data to your Kinesis video stream.

The procedure includes the following steps:


  • Credentials: In the sample code, you provide credentials by specifying a profile that you set up in your Amazon credentials profile file. If you haven't already done so, first set up your credentials profile.

    For more information, see Set up Amazon Credentials and Region for Development.

  • Certificate store integration: The Kinesis Video Streams Producer Library must establish trust with the service it calls. This is done through validating the certificate authorities (CAs) in the public certificate store. On Linux-based models, this store is located in the /etc/ssl/ directory.

    Download the certificate from the following location to your certificate store:

  • Install the following build dependencies for macOS:

  • Install the following build dependencies for Ubuntu:

    • Git: sudo apt install git

    • CMake: sudo apt install cmake

    • G++: sudo apt install g++

    • pkg-config: sudo apt install pkg-config

    • OpenJDK: sudo apt install openjdk-8-jdk


      This is only required if you’re building Java Native Interface (JNI).

    • Set the JAVA_HOME environment variable: export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/

Next step

Step 1: Download and Configure the C++ Producer Library Code