Download and build the Kinesis Video Streams C++ producer SDK
Follow the procedures below to download and build the Kinesis Video Streams C++ producer SDK
-
Navigate to download directory. Open a terminal and change to your preferred download directory.
For example:
cd ~/Downloads Clone the SDK repository. Use the
git clonecommand to download the SDK from the GitHub repository. Type:git clone https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp.git --single-branch -b master kvs-producer-sdk-cppThis command clones only a single branch (the
masterbranch), reducing the download size and time. It also places the downloaded contents into a folder calledkvs-producer-sdk-cppwithin the current directory.-
Verify the download. Once the cloning process is complete, list the contents of the
kvs-producer-sdk-cppfolder to verify that the SDK has been downloaded.ls kvs-producer-sdk-cpp Prepare a build directory. Type:
mkdir -p kvs-producer-sdk-cpp/build cd kvs-producer-sdk-cpp/build-
Configure the build. Run the following
cmakecommand to configure the build environment with specific options:cmake .. -DBUILD_GSTREAMER_PLUGIN=ON -DBUILD_DEPENDENCIES=OFF -DALIGNED_MEMORY_MODEL=ONCMake
uses the following options to generate the appropriate Makefiles:Using the project folder (
..) as the source directory.Using the current directory (
.) (build/) for build output.-DBUILD_GSTREAMER_PLUGIN=ONenables the building of the GStreamer plugin kvssink.-DBUILD_DEPENDENCIES=OFFdisables building external dependencies from source. The project will find and use the external dependencies installed in a previous step.-DALIGNED_MEMORY_MODEL=ONdisables the unaligned memory model. Unaligned memory access is not supported by certain Raspberry Pi devices.
Note
For a full list of CMake arguments, see Download and configure the C++ producer library code.
Build the project. After configuring the build, use the
makecommand to compile using theMakefilegenerated bycmake.make -j$(nproc)The
-jargument tomakeallows it to run multiple compilation jobs in parallel. To reduce build times, use thenproccommand to dynamically calculate the number of CPU cores on your Raspberry Pi.Confirm that
libgstkvssink.sois present.List the files in the current directory.
Prompt:
lsResponse:
CMakeCache.txt dependency kvs_gstreamer_sample CMakeFiles kvs_gstreamer_audio_video_sample kvssink_gstreamer_sample Makefile kvs_gstreamer_file_uploader_sample libKinesisVideoProducer.so cmake_install.cmake kvs_gstreamer_multistream_samplelibgstkvssink.soConfirm that GStreamer can load
kvssink.Set the
GST_PLUGIN_PATHenvironment variable to the directory containinglibgstkvssink.so.export GST_PLUGIN_PATH=`pwd`Have GStreamer load
kvssink:gst-inspect-1.0 kvssinkYou should see some documentation about
kvssink. Use the arrow keys to navigate and pressqto exit.(Optional) Update your shell's start-up script to include setting the
GST_PLUGIN_PATHenvironment variable. This ensuresGST_PLUGIN_PATHis set properly during a new terminal session. On Raspberry Pi devices, the shell's start-up script is~/.bashrc.Run the following command to append the command to the end of the shell's start-up script.
echo "export GST_PLUGIN_PATH=~/Downloads/kvs-producer-sdk-cpp/build" >> ~/.bashrcType the following to run the shell's start-up script, or close the current shell and open a new one.
source ~/.bashrcConfirm the
GST_PLUGIN_PATHis set and you can loadkvssink.echo $GST_PLUGIN_PATHgst-inspect-1.0 kvssink