Skip to content

Commit

Permalink
Updated CMakeLists.txt and install scripts to be able to link against…
Browse files Browse the repository at this point in the history
… libraries in default system path.

Optimization and bug fixes.
  • Loading branch information
chehefen committed Mar 7, 2019
1 parent 747bbd8 commit 5888464
Show file tree
Hide file tree
Showing 39 changed files with 1,961 additions and 1,009 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
### Amazon Kinesis Video Streams Producer SDK C/C++
----
### Attention
----
If you are updating from any release before 1.7.0, you need to specify a track id for each Frame as shown in [sample](https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp/blob/master/kinesis-video-gst-demo/kinesis_video_gstreamer_sample_app.cpp#L312), otherwise you will get a 0x32000026 which means track not found.

----
### Introduction
----
Expand Down Expand Up @@ -45,6 +50,10 @@ This library is licensed under the Amazon Software License.
----
### Release notes

#### Release 1.7.8 (6th Mar 2019)
* Updated CMakeLists.txt and install scripts to be able to link against libraries in default system path.
* Optimization and bug fixes.

#### Release 1.7.7 (22th Feb 2019)
* Stability and bug fixes.

Expand All @@ -68,6 +77,7 @@ This library is licensed under the Amazon Software License.
* stability fixes.

#### Release 1.7.0 (14th Dec 2018)
* Applications need to specify a trackId for every Frame as shown in create_kinesis_video_frame function in the samples
* Added support for uploading files(offline mode) to Kinesis Video Stream
* Additional fixes

Expand Down
103 changes: 27 additions & 76 deletions install-instructions-linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ Many platforms come with a cert file with a lot of the well-known public certs i
----
### Build the Kinesis Video Producer SDK and sample applications:

##### Build the SDK and sample applications using open source library dependencies built from source

The **install-script** will download and build the dependent open source components (from the source) into the **downloads** directory within `kinesis-video-native-build` directory (e.g. `/home/<myuser>/downloads/amazon-kinesis-video-streams-producer-sdk-cpp/kinesis-video-native-build/downloads`) and link against it.

**After you've downloaded the code from GitHub, you can build it on Linux by running `./install-script` (which is inside the `kinesis-video-native-build` directory)**.
Expand All @@ -44,73 +46,32 @@ The **install-script** will download and build the dependent open source compone

Note that the install-script also builds the Kinesis Video Streams producer SDK as a **GStreamer plugin** (**kvssink**).

----
##### Alternate option to build the SDK and sample applications using system versions of open source library dependencies

The bulk of the **install-script** is building the open source dependencies. The project is based on **CMake**. So the open source components building can be skipped if the system versions of the open source dependencies are already installed that can be used for linking. See the section **Install Steps for Ubuntu 17.x using apt-get** for detailed instructions on how to install using `apt-get install` on **Ubuntu** .
The bulk of the **install-script** is building the open source dependencies. The project is based on **CMake**. So the open source components building can be skipped if the system versions of the open source dependencies are already installed that can be used for linking. See the section **Install Steps for Ubuntu 17.x and Raspbian Stretch using apt-get** for detailed instructions on how to install using `apt-get install` on **Ubuntu** .

Running

```
$ cmake .
$ make
```
from the `kinesis-video-native-build` directory will build and link the SDK.

The `./min-install-script` inside the `kinesis-video-native-build` captures these steps for installing the Kinesis Video Streams Producer SDK with the system versions for linking.
The `./min-install-script` inside the `kinesis-video-native-build` captures these steps for building the Kinesis Video Streams Producer SDK with the system versions for linking.

##### Optionally build the native library (KinesisVideoProducerJNI) to run Java demo streaming application

The `./java-install-script` inside `kinesis-video-native-build` will build the KinesisVideoProducerJNI native library to be used by [Java Producer SDK](https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-java/blob/master/README.md).

----

### Install Steps for Ubuntu 17.x using apt-get

The following section provides guidance for installing the build tools and open source dependencies using `apt-get` in **Ubuntu Linux**.
### Install Steps for Ubuntu 17.x and Raspbian Stretch using apt-get

The following are the steps to install the build-time prerequisites for Ubuntu 17.x
The following section provides guidance for installing the build tools and open source dependencies using `apt-get` and has been tested in **Ubuntu Linux** and **Raspbian Stretch**.

Install **git**:

```
$ sudo apt-get update
$ sudo apt-get install git
$ git --version
git version 2.14.1
```
Install **cmake**:
```
sudo apt-get update
$ sudo apt-get install cmake
$ cmake --version
cmake version 3.9.1
```

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Install **libtool**: (some images come preinstalled) amd **libtool-bin**
```
$ sudo apt-get install libtool
$ sudo apt-get install libtool-bin
$ libtool --version
libtool (GNU libtool) 2.4.6
Written by Gordon Matzigkeit, 1996
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```
Install **automake**:
```
$ sudo apt-get install automake
$ automake --version
automake (GNU automake) 1.15
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Tom Tromey <tromey@redhat.com>
and Alexandre Duret-Lutz <adl@gnu.org>.
```
Install **g++**:
```
Expand All @@ -121,39 +82,28 @@ Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```
Install **curl**:
Install **Producer Library Dependencies**:

```
$ sudo apt-get install curl
$ curl --version
curl 7.55.1 (x86_64-pc-linux-gnu) libcurl/7.55.1 OpenSSL/1.0.2g zlib/1.2.11 libidn2/2.0.2 libpsl/0.18.0 (+libidn2/2.0.2) librtmp/2.3
Release-Date: 2017-08-14
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy PSL
$ sudo apt-get update
$ sudo apt-get install libssl-dev libcurl4-openssl-dev liblog4cplus-1.1-9 liblog4cplus-dev
```
Install **pkg-config**:
Install **Gstreamer Artifact Dependencies**:
```
$ sudo apt-get install pkg-config
$ pkg-config --version
0.29.1
$ sudo apt-get update
$ sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-base-apps
$ sudo apt-get install gstreamer1.0-plugins-bad gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-tools
```
Install **flex**:
If you are using Raspberry pi, you can also install the `gstreamer1.0-omx` package to get the omxh264enc hardware encoder
```
$ sudo apt-get install flex
$ flex --version
flex 2.6.1
sudo apt-get install gstreamer1.0-omx
```
Install **bison**:
Run the build script: (within `kinesis-video-native-build` folder)
```
$ sudo apt-get install bison
$ bison -V
bison (GNU Bison) 3.0.4
Written by Robert Corbett and Richard Stallman.
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
./min-install-script
```
Install **Open JDK**:

Install **Open JDK** (if you are building the JNI library):
```
$ sudo apt-get install openjdk-8-jdk
$ java -showversion
Expand All @@ -165,9 +115,10 @@ Set **JAVA_HOME** environment variable:
```
$ export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/
```

Run the build script: (within `kinesis-video-native-build` folder)
```
./install-script
$ ./java-install-script
```

----
Expand All @@ -190,7 +141,7 @@ the LD_LIBRARY_PATH as below:
```
export LD_LIBRARY_PATH=/opt/awssdk/amazon-kinesis-video-streams-producer-sdk-cpp/kinesis-video-native-build/downloads/local/lib:$LD_LIBRARY_PATH
```
* The `gst-launch-1.0` and `gst-inspect-1.0` binaries are built inside the folder `<YourSdkFolderPath>/kinesis-video-native-build/downloads/local/bin`. You can either run the following commands from that folder using `./gst-launch-1.0` or you can include that in your **PATH** environment variable using the following export command and run `gst-launch-1.0`
* (Skip this if you installed gstreamer using apt-get) The `gst-launch-1.0` and `gst-inspect-1.0` binaries are built inside the folder `<YourSdkFolderPath>/kinesis-video-native-build/downloads/local/bin`. You can either run the following commands from that folder using `./gst-launch-1.0` or you can include that in your **PATH** environment variable using the following export command and run `gst-launch-1.0`
```
$ export PATH=<YourSdkFolderPath>/kinesis-video-native-build/downloads/local/bin:$PATH
```
Expand Down Expand Up @@ -337,13 +288,13 @@ AWS_ACCESS_KEY_ID=YourAccessKeyId AWS_SECRET_ACCESS_KEY=YourSecretAccessKey ./ki
gst-launch-1.0 -v filesrc location="YourAudioVideo.mkv" ! matroskademux name=demux ! queue ! h264parse ! kvssink name=sink stream-name="my_stream_name" access-key="YourAccessKeyId" secret-key="YourSecretAccessKey" streaming-type=offline demux. ! queue ! aacparse ! sink.
```

###### Running the `gst-launch-1.0` command to upload MPEG2TS file that contains both *audio and video* in **Raspberry-PI**.
###### Running the `gst-launch-1.0` command to upload MP4 file that contains both *audio and video* in **Raspberry-PI**.

```
gst-launch-1.0 -v filesrc location="YourAudioVideo.mp4" ! qtdemux name=demux ! queue ! h264parse ! video/x-h264,stream-format=avc,alignment=au ! kvssink name=sink stream-name="audio-video-file" access-key="YourAccessKeyId" secret-key="YourSecretAccessKey" streaming-type=offline demux. ! queue ! aacparse ! sink.
```

###### Running the `gst-launch-1.0` command to upload MP4 file that contains both *audio and video* in **Raspberry-PI**.
###### Running the `gst-launch-1.0` command to upload MPEG2TS file that contains both *audio and video* in **Raspberry-PI**.

```
gst-launch-1.0 -v filesrc location="YourAudioVideo.ts" ! tsdemux name=demux ! queue ! h264parse ! video/x-h264,stream-format=avc,alignment=au ! kvssink name=sink stream-name="audio-video-file" access-key="YourAccessKeyId" secret-key="YourSecretAccessKey" streaming-type=offline demux. ! queue ! aacparse ! sink.
Expand Down
24 changes: 10 additions & 14 deletions install-instructions-macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ In order to build the Producer SDK and download open source dependencies the fol
_**Note:**_ If you have installed these build tools using `brew` you need to set the PATH environment variable to include the installed location.
e.g. To incldue the latest `bison` you can run `export PATH=/usr/local/Cellar/bison/3.0.4_1/bin/:$PATH`

##### Install the certificate in the operating system certificate store
Kinesis Video Streams Producer SDK for C++ needs to establish trust with the backend service through TLS. This is done through validating the CAs in the public certificate store. On Linux-based models, this store is located in `/etc/ssl/` directory by default.

Please download the PEM file from [SFSRootCAG2.pem](https://www.amazontrust.com/repository/SFSRootCAG2.pem)
to `/etc/ssl/cert.pem`. If the file already exists `/etc/ssl/cert.pem` then you can append it by running `sudo cat SFSRootCAG2.pem >> /etc/ssl/cert.pem`.

Many platforms come with a cert file with a lot of the well-known public certs in them.

----
### Build the Kinesis Video Producer SDK and sample applications:
The **install-script** will download and build the dependent open source components (from the source) into the **downloads** directory within `kinesis-video-native-build` directory (e.g. `/Users/<myuser>/downloads/amazon-kinesis-video-streams-producer-sdk-cpp/kinesis-video-native-build/downloads`) and link against it.
Expand All @@ -50,15 +42,19 @@ The **install-script** will download and build the dependent open source compone
Note that the install-script also builds the Kinesis Video Streams producer SDK as a **GStreamer plugin** (**kvssink**).

----
##### Alternate option to build the SDK and sample applications using system versions of open source library dependencies
### Alternate option to build the SDK and sample applications using libraries installed by Homebrew

The bulk of the **install script** is building the open source dependencies. The project is based on **CMake**. So the open source components building can be skipped if the system versions of the open source dependencies are already installed that can be used for linking.

Running
First make sure that the following libraries have been installed using Homebrew
```
brew install pkg-config openssl cmake gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly log4cplus
```

After all required libraries have been installed, run

```
$ cmake .
$ make
$ ./min-install-script
```
from the `kinesis-video-native-build` directory will build and link the SDK.

Expand Down Expand Up @@ -182,13 +178,13 @@ AWS_ACCESS_KEY_ID=YourAccessKeyId AWS_SECRET_ACCESS_KEY=YourSecretAccessKey ./ki
gst-launch-1.0 -v filesrc location="YourAudioVideo.mkv" ! matroskademux name=demux ! queue ! h264parse ! kvssink name=sink stream-name="my_stream_name" access-key="YourAccessKeyId" secret-key="YourSecretAccessKey" streaming-type=offline demux. ! queue ! aacparse ! sink.
```

###### Running the `gst-launch-1.0` command to upload MPEG2TS file that contains both *audio and video* in **Mac-OS**.
###### Running the `gst-launch-1.0` command to upload MP4 file that contains both *audio and video* in **Mac-OS**.

```
gst-launch-1.0 -v filesrc location="YourAudioVideo.mp4" ! qtdemux name=demux ! queue ! h264parse ! video/x-h264,stream-format=avc,alignment=au ! kvssink name=sink stream-name="audio-video-file" access-key="YourAccessKeyId" secret-key="YourSecretAccessKey" streaming-type=offline demux. ! queue ! aacparse ! sink.
```

###### Running the `gst-launch-1.0` command to upload MP4 file that contains both *audio and video* in **Mac-OS**.
###### Running the `gst-launch-1.0` command to upload MPEG2TS file that contains both *audio and video* in **Mac-OS**.

```
gst-launch-1.0 -v filesrc location="YourAudioVideo.ts" ! tsdemux name=demux ! queue ! h264parse ! video/x-h264,stream-format=avc,alignment=au ! kvssink name=sink stream-name="audio-video-file" access-key="YourAccessKeyId" secret-key="YourSecretAccessKey" streaming-type=offline demux. ! queue ! aacparse ! sink.
Expand Down
4 changes: 2 additions & 2 deletions install-instructions-windows-msvc.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,13 @@ gst-launch-1.0 -v ksvideosrc ! h264parse ! video/x-h264,stream-format=avc,alignm
gst-launch-1.0 -v filesrc location="YourAudioVideo.mkv" ! matroskademux name=demux ! queue ! h264parse ! kvssink name=sink stream-name="my_stream_name" access-key="YourAccessKeyId" secret-key="YourSecretAccessKey" streaming-type=offline demux. ! queue ! aacparse ! sink.
```

###### Running the `gst-launch-1.0` command to upload MPEG2TS file that contains both *audio and video*.
###### Running the `gst-launch-1.0` command to upload MP4 file that contains both *audio and video*.

```
gst-launch-1.0 -v filesrc location="YourAudioVideo.mp4" ! qtdemux name=demux ! queue ! h264parse ! video/x-h264,stream-format=avc,alignment=au ! kvssink name=sink stream-name="audio-video-file" access-key="YourAccessKeyId" secret-key="YourSecretAccessKey" streaming-type=offline demux. ! queue ! aacparse ! sink.
```

###### Running the `gst-launch-1.0` command to upload MP4 file that contains both *audio and video*.
###### Running the `gst-launch-1.0` command to upload MPEG2TS file that contains both *audio and video*.

```
gst-launch-1.0 -v filesrc location="YourAudioVideo.ts" ! tsdemux name=demux ! queue ! h264parse ! video/x-h264,stream-format=avc,alignment=au ! kvssink name=sink stream-name="audio-video-file" access-key="YourAccessKeyId" secret-key="YourSecretAccessKey" streaming-type=offline demux. ! queue ! aacparse ! sink.
Expand Down
8 changes: 4 additions & 4 deletions install-instructions-windows-msys2.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ Now the MingW shell prompt will look similar to the one below.
$
```

###### Step 6: Build the Kinesis Video Streams Producer SDK using msys2-install-script.
Build the SDK by running the command `./msys2-install-script -a`
###### Step 6: Build the Kinesis Video Streams Producer SDK using min-install-script.
Build the SDK by running the command `./min-install-script`
Press Enter to all prompts that show up during the install the process. When the install script finishes, the demo executables and libraries will be in the kinesis-video-native-build directory. Please note that this step could take about **25 mins**.

----
Expand Down Expand Up @@ -160,13 +160,13 @@ AWS_ACCESS_KEY_ID=YourAccessKeyId AWS_SECRET_ACCESS_KEY=YourSecretAccessKey ./ki
gst-launch-1.0 -v filesrc location="YourAudioVideo.mkv" ! matroskademux name=demux ! queue ! h264parse ! kvssink name=sink stream-name="my_stream_name" access-key="YourAccessKeyId" secret-key="YourSecretAccessKey" streaming-type=offline demux. ! queue ! aacparse ! sink.
```

###### Running the `gst-launch-1.0` command to upload MPEG2TS file that contains both *audio and video* in **Mingw Shell**.
###### Running the `gst-launch-1.0` command to upload MP4 file that contains both *audio and video* in **Mingw Shell**.

```
gst-launch-1.0 -v filesrc location="YourAudioVideo.mp4" ! qtdemux name=demux ! queue ! h264parse ! video/x-h264,stream-format=avc,alignment=au ! kvssink name=sink stream-name="audio-video-file" access-key="YourAccessKeyId" secret-key="YourSecretAccessKey" streaming-type=offline demux. ! queue ! aacparse ! sink.
```

###### Running the `gst-launch-1.0` command to upload MP4 file that contains both *audio and video* in **Mingw Shell**.
###### Running the `gst-launch-1.0` command to upload MPEG2TS file that contains both *audio and video* in **Mingw Shell**.

```
gst-launch-1.0 -v filesrc location="YourAudioVideo.ts" ! tsdemux name=demux ! queue ! h264parse ! video/x-h264,stream-format=avc,alignment=au ! kvssink name=sink stream-name="audio-video-file" access-key="YourAccessKeyId" secret-key="YourSecretAccessKey" streaming-type=offline demux. ! queue ! aacparse ! sink.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ LOGGER_TAG("com.amazonaws.kinesis.video.gstreamer");
#define APP_SINK_BASE_NAME "appsink"
#define DEFAULT_BUFFER_SIZE (1 * 1024 * 1024)
#define DEFAULT_STORAGE_SIZE (128 * 1024 * 1024)
#define DEFAULT_CREDENTIAL_ROTATION_SECONDS 120
#define DEFAULT_CREDENTIAL_ROTATION_SECONDS 2400
#define DEFAULT_CREDENTIAL_EXPIRATION_SECONDS 180
#define DEFAULT_AUDIO_VIDEO_DRIFT_TIMEOUT_SECOND 5

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ LOGGER_TAG("com.amazonaws.kinesis.video.gstreamer");
#define DEFAULT_FRAME_DURATION_MS 1
#define DEFAULT_FRAME_DATA_SIZE_BYTE 5000
#define FRAME_DATA_SIZE_MULTIPLIER 1.5
#define DEFAULT_CREDENTIAL_ROTATION_SECONDS 120
#define DEFAULT_CREDENTIAL_ROTATION_SECONDS 2400
#define DEFAULT_CREDENTIAL_EXPIRATION_SECONDS 180

typedef enum _StreamSource {
Expand Down
Loading

0 comments on commit 5888464

Please sign in to comment.