Skip to content

Commit 4dfa26f

Browse files
committed
Audio integration for Kinesis Video Streams. Now Kinesis Video Streams Producer SDK CPP supports ingesting video and audio.
1 parent e3b3726 commit 4dfa26f

File tree

9 files changed

+649
-69
lines changed

9 files changed

+649
-69
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ This library is licensed under the Amazon Software License.
4545
----
4646
### Release notes
4747

48+
#### Release 1.7.6 (21th Feb 2019)
49+
* Audio integration for Kinesis Video Stream. Now Kinesis Video Streams Producer SDK CPP supports ingesting video and audio.
50+
51+
#### Release 1.7.5 (16th Feb 2019)
52+
* Stability and bug fixes.
53+
4854
#### Release 1.7.4 (14th Feb 2019)
4955
* Stability and bug fixes.
5056

install-instructions-linux.md

Lines changed: 159 additions & 10 deletions
Large diffs are not rendered by default.

install-instructions-macos.md

Lines changed: 98 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ optionally, set `AWS_SESSION_TOKEN` if integrating with temporary token and `AWS
8181

8282
----
8383
##### Setting the environment variables for library path
84-
At the end of installation (with `install-script`), environment setup is saved in the `set_kvs_sdk_env.sh`. Next time you want to run the demo applications or use **gst-launch-1.0** to send video to Kinesis Video Streams, you can run this script by `. ./set_kvs_sdk_env.sh` or ` source set_kvs_sdk_env.sh`
84+
At the end of installation (with `install-script`), environment setup is saved in the `set_kvs_sdk_env.sh`. Next time you want to run the sample applications or use **gst-launch-1.0** to send video to Kinesis Video Streams, you can run this script by `. ./set_kvs_sdk_env.sh` or ` source set_kvs_sdk_env.sh`
8585
within the `kinesis-video-native-build` directory. This set up the environment for **LD_LIBRARY_PATH**, **PATH** and **GST_PLUGIN_PATH**. You can also set these environment variables manually as below.
8686
* Export the **LD_LIBRARY_PATH**=`<full path to your sdk cpp directory`>/kinesis-video-native-build/downloads/local/lib. For example, if you have downloaded the CPP SDK in `/opt/awssdk` directory then you can set
8787
the LD_LIBRARY_PATH as below:
@@ -97,51 +97,131 @@ $ export PATH=<YourSdkFolderPath>/kinesis-video-native-build/downloads/local/bin
9797
$ export GST_PLUGIN_PATH=<YourSdkFolderPath>/kinesis-video-native-build/downloads/local/lib:$GST_PLUGIN_PATH
9898
```
9999

100+
###### Discovering available devices.
101+
Change your current working directory to `<YourSdkFolderPath>/kinesis-video-native-build/downloads/local/bin`;
102+
then run the `gst-device-monitor-1.0` command to identify available media devices in your system. An example output as follows:
103+
```
104+
Device found:
105+
106+
name : HD Pro Webcam C920
107+
class : Audio/Source
108+
caps : audio/x-raw, format=(string)F32LE, layout=(string)interleaved, rate=(int)16000, channels=(int)2, channel-mask=(bitmask)0x0000000000000003;
109+
audio/x-raw, format=(string){ S8, U8, S16LE, S16BE, U16LE, U16BE, S24_32LE, S24_32BE, U24_32LE, U24_32BE, S32LE, S32BE, U32LE, U32BE, S24LE, S24BE, U24LE, U24BE, S20LE, S20BE, U20LE, U20BE, S18LE, S18BE, U18LE, U18BE, F32LE, F32BE, F64LE, F64BE }, layout=(string)interleaved, rate=(int)16000, channels=(int)2, channel-mask=(bitmask)0x0000000000000003;
110+
audio/x-raw, format=(string){ S8, U8, S16LE, S16BE, U16LE, U16BE, S24_32LE, S24_32BE, U24_32LE, U24_32BE, S32LE, S32BE, U32LE, U32BE, S24LE, S24BE, U24LE, U24BE, S20LE, S20BE, U20LE, U20BE, S18LE, S18BE, U18LE, U18BE, F32LE, F32BE, F64LE, F64BE }, layout=(string)interleaved, rate=(int)16000, channels=(int)1;
111+
gst-launch-1.0 osxaudiosrc device=67 ! ...
112+
```
113+
100114
----
101115
###### Running the `gst-launch-1.0` command to start streaming from RTSP camera source.
102116

103117
```
104-
$ gst-launch-1.0 rtspsrc location=rtsp://YourCameraRtspUrl short-header=TRUE ! rtph264depay ! video/x-h264, format=avc,alignment=au ! kvssink stream-name=YourStreamName storage-size=512
118+
$ gst-launch-1.0 rtspsrc location=rtsp://YourCameraRtspUrl short-header=TRUE ! rtph264depay ! video/x-h264, format=avc,alignment=au ! kvssink stream-name=YourStreamName storage-size=128 access-key="YourAccessKey" secret-key="YourSecretKey"
105119
```
106120

107-
**Note:** If you are using IoT credentials then you can pass them as parameters to the gst-launch-1.0 command
121+
**Note:** If you are using **IoT credentials** then you can pass them as parameters to the gst-launch-1.0 command
108122

109123
```
110124
$ gst-launch-1.0 rtspsrc location=rtsp://YourCameraRtspUrl short-header=TRUE ! rtph264depay ! video/x-h264, format=avc,alignment=au !
111125
kvssink stream-name="iot-stream" iot-certificate="iot-certificate,endpoint=endpoint,cert-path=/path/to/certificate,key-path=/path/to/private/key,ca-path=/path/to/ca-cert,role-aliases=role-aliases"
112126
```
127+
You can find the RTSP URL from your IP camera manual or manufacturers product page.
113128

114129
###### Running the `gst-launch-1.0` command to start streaming from camera source in **Mac-OS**.
115130

116131
```
117-
$ gst-launch-1.0 autovideosrc ! videoconvert ! video/x-raw,format=I420,width=640,height=480,framerate=30/1 ! vtenc_h264_hw allow-frame-reordering=FALSE realtime=TRUE max-keyframe-interval=45 bitrate=500 ! h264parse ! video/x-h264,stream-format=avc,alignment=au,width=640,height=480,framerate=30/1 ! kvssink stream-name=YourStreamName storage-size=512
132+
$ gst-launch-1.0 autovideosrc ! videoconvert ! video/x-raw,format=I420,width=640,height=480,framerate=30/1 ! vtenc_h264_hw allow-frame-reordering=FALSE realtime=TRUE max-keyframe-interval=45 bitrate=500 ! h264parse ! video/x-h264,stream-format=avc,alignment=au,profile=baseline ! kvssink stream-name=YourStreamName storage-size=128 access-key="YourAccessKey" secret-key="YourSecretKey"
133+
```
134+
135+
###### Running the `gst-launch-1.0` command to start streaming both audio and raw video in **Mac-OS**.
136+
137+
```
138+
gst-launch-1.0 -v avfvideosrc ! videoconvert ! vtenc_h264_hw allow-frame-reordering=FALSE realtime=TRUE max-keyframe-interval=45 ! kvssink name=sink stream-name="my_stream_name" access-key="YourAccessKeyId" secret-key="YourSecretAccessKey" osxaudiosrc ! audioconvert ! avenc_aac ! queue ! sink.
139+
```
140+
141+
###### Running the `gst-launch-1.0` command to start streaming both audio and h264 encoded video in **Mac-OS**.
142+
143+
```
144+
gst-launch-1.0 -v avfvideosrc device-index=1 ! h264parse ! kvssink name=sink stream-name="my_stream_name" access-key="YourAccessKeyId" secret-key="YourSecretAccessKey" osxaudiosrc ! audioconvert ! avenc_aac ! queue ! sink.
118145
```
119146

120-
##### Running the GStreamer webcam demo application
121-
The demo application `kinesis_video_gstreamer_sample_app` in the `kinesis-video-native-build` directory uses GStreamer pipeline to get video data from the camera. Launch it with a stream name and it will start streaming from the camera. The user can also supply a streaming resolution (width and height) through command line arguments.
147+
The pipeline above uses default video and audio source on a Mac. If you have an audio enable webcam plugged in, you can first use `gst-device-monitor-1.0` command mentioned above to find out the index for webcam's microphone. The example audio video pipeline using the webcam looks like follows:
148+
149+
```
150+
gst-launch-1.0 -v avfvideosrc device-index=1 ! videoconvert ! vtenc_h264_hw allow-frame-reordering=FALSE realtime=TRUE max-keyframe-interval=45 ! kvssink name=sink stream-name="my_stream_name" access-key="YourAccessKeyId" secret-key="YourSecretAccessKey" osxaudiosrc device=67 ! audioconvert ! avenc_aac ! queue ! sink.
151+
```
152+
153+
##### Running the GStreamer webcam sample application
154+
The sample application `kinesis_video_gstreamer_sample_app` in the `kinesis-video-native-build` directory uses GStreamer pipeline to get video data from the camera. Launch it with a stream name and it will start streaming from the camera. The user can also supply a streaming resolution (width and height) through command line arguments.
122155

123156
```
124157
Usage: AWS_ACCESS_KEY_ID=YourAccessKeyId AWS_SECRET_ACCESS_KEY=YourSecretAccessKey ./kinesis_video_gstreamer_sample_app <my_stream_name> -w <width> -h <height> -f <framerate> -b <bitrateInKBPS>
125158
```
126159
* **A.** If **resolution is provided** then the sample will try to check if the camera supports that resolution. If it does detect that the camera can support the resolution supplied in command line, then streaming starts; else, it will fail with an error message `Resolution not supported`.
127-
* **B.** If **no resolution is specified**, the demo will try to use these three resolutions **640x480, 1280x720 and 1920x1080** and will **start streaming** once the camera supported resolution is detected.
160+
* **B.** If **no resolution is specified**, the sample application will try to use these three resolutions **640x480, 1280x720 and 1920x1080** and will **start streaming** once the camera supported resolution is detected.
128161

129-
##### Running the GStreamer RTSP demo application
130-
`kinesis_video_gstreamer_sample_app` also supports taking a rtsp url. In the `kinesis-video-native-build` directory. Launch it with a stream name and `rtsp_url` and it will start streaming.
162+
##### Running the GStreamer RTSP sample application
163+
`kinesis_video_gstreamer_sample_app` supports sending video from a RTSP URL (IP camera). You can find the RTSP URL from your IP camera manual or manufacturers product page. Change your current working direcctory to `kinesis-video-native-build` directory. Launch it with a stream name and `rtsp_url` and it will start streaming.
131164

132165
```
133166
AWS_ACCESS_KEY_ID=YourAccessKeyId AWS_SECRET_ACCESS_KEY=YourSecretAccessKey ./kinesis_video_gstreamer_sample_app <my-rtsp-stream> <my_rtsp_url>
134167
```
135168

136-
##### Uploading a video file
137-
`kinesis_video_gstreamer_sample_app` also supports uploading a video that is either mkv, mpegts, or mp4. The file content has to be h264 encoded. In the `kinesis-video-native-build` directory. Launch it with a stream name and a path to the file and it will start streaming.
169+
##### Running the GStreamer sample application to upload a *video* file
170+
171+
`kinesis_video_gstreamer_sample_app` supports uploading a video that is either MKV, MPEGTS, or MP4. The sample application expects the video is encoded in H264.
172+
173+
Change your current working directory to `kinesis-video-native-build`. Launch the sample application with a stream name and a path to the file and it will start streaming.
138174

139175
```
140176
AWS_ACCESS_KEY_ID=YourAccessKeyId AWS_SECRET_ACCESS_KEY=YourSecretAccessKey ./kinesis_video_gstreamer_sample_app <my-stream> </path/to/file>
141177
```
142178

143-
##### Using Docker to run the demo application
144-
Refer the **README.md** file in the *docker_native_scripts* folder for running the build and **RTSP demo application** to start streaming from **IP camera** within Docker container.
179+
###### Running the `gst-launch-1.0` command to upload [MKV](https://www.matroska.org/) file that contains both *audio and video* in **Mac-OS**. Note that video should be H264 encoded and audio should be AAC encoded.
180+
181+
```
182+
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.
183+
```
184+
185+
###### Running the `gst-launch-1.0` command to upload MPEG2TS file that contains both *audio and video* in **Mac-OS**.
186+
187+
```
188+
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.
189+
```
190+
191+
###### Running the `gst-launch-1.0` command to upload MP4 file that contains both *audio and video* in **Mac-OS**.
192+
193+
```
194+
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.
195+
```
196+
197+
##### Running the GStreamer sample application to upload a *audio and video* file
198+
199+
`kinesis_video_gstreamer_audio_video_sample_app` supports uploading a video that is either MKV, MPEGTS, or MP4. The sample application expects the video is encoded in H264 and audio is encoded in AAC format. Note: If your media uses a different format, then you can revise the pipeline elements in the sample application to suit your media format.
200+
201+
Change your current working directory to `kinesis-video-native-build`. Launch the sample application with a stream name and a path to the file and it will start streaming.
202+
203+
```
204+
AWS_ACCESS_KEY_ID=YourAccessKeyId AWS_SECRET_ACCESS_KEY=YourSecretAccessKey ./kinesis_video_gstreamer_audio_video_sample_app <my-stream> </path/to/file>
205+
```
206+
207+
##### Running the GStreamer sample application to stream audio and video from live source
208+
209+
`kinesis_video_gstreamer_audio_video_sample_app` supports streaming audio and video from live sources such as a audio enabled webcam. First you need to figure out what your audio device is using the steps mentioned above and export it as environment variable like such:
210+
211+
`export AWS_KVS_AUDIO_DEVICE=67`
212+
213+
You can also choose to use other video devices by doing
214+
215+
`export AWS_KVS_VIDEO_DEVICE=1`
216+
217+
If no `AWS_KVS_VIDEO_DEVICE` or `AWS_KVS_AUDIO_DEVICE` environment variable was detected, the sample app will use the default device.
218+
After the environment variables are set, launch the sample application with a stream name and it will start streaming.
219+
```
220+
AWS_ACCESS_KEY_ID=YourAccessKeyId AWS_SECRET_ACCESS_KEY=YourSecretAccessKey ./kinesis_video_gstreamer_audio_video_sample_app <my-stream>
221+
```
222+
223+
##### Using Docker to run the sample application
224+
Refer the **README.md** file in the *docker_native_scripts* folder for running the build and **RTSP sample application** to start streaming from **IP camera** within Docker container.
145225

146226
##### Additional examples
147227
For additional examples on using Kinesis Video Streams Java SDK and Kinesis Video Streams Parsing Library refer:
@@ -160,7 +240,7 @@ Define `HEAP_DEBUG` and `LOG_STREAMING` C-defines by uncommenting the appropriat
160240
----
161241
##### How to configure logging for producer SDK sample applications.
162242

163-
For the sample demo applications included in the producer SDK (CPP), the log configuration is referred from the file `kvs_log_configuration` (within the `kinesis-video-native-build` folder).
243+
For the sample applications included in the producer SDK (CPP), the log configuration is referred from the file `kvs_log_configuration` (within the `kinesis-video-native-build` folder).
164244

165245
Refer sample configuration in the folder `kinesis-video-native-build` for details on how to set the log level (DEBUG or INFO) and output options (whether to send log output to either console or file (or both)).
166246
* Log output messages to console:
@@ -170,7 +250,7 @@ Refer sample configuration in the folder `kinesis-video-native-build` for detail
170250
----
171251
#### Troubleshooting:
172252

173-
##### Library not found error when running the demo application
253+
##### Library not found error when running the sample application
174254
If any error similar to the following shows that the library path is not properly set:
175255
```
176256
liblog4cplus-1.2.so.5: cannot open shared object file: No such file or directory
@@ -205,7 +285,7 @@ make install
205285

206286
The projects depend on the following open source components. Running `install-script` will download and build the necessary components automatically.You can also install them in **Mac-OS** using `brew` and use the `min-install-script`.
207287

208-
###### Producer SDK Core
288+
###### Producer SDK core dependencies
209289
* openssl (crypto and ssl) - [License](https://github.com/openssl/openssl/blob/master/LICENSE)
210290
* libcurl - [Copyright](https://curl.haxx.se/docs/copyright.html)
211291
* log4cplus - [License]( https://github.com/log4cplus/log4cplus/blob/master/LICENSE)
@@ -214,10 +294,10 @@ The projects depend on the following open source components. Running `install-sc
214294
* libtool (Apple Inc. version cctools-898)
215295
* jsoncpp - [License](https://github.com/open-source-parsers/jsoncpp/blob/master/LICENSE)
216296

217-
###### Unit Tests
297+
###### Unit test dependencies
218298
* [googletest](https://github.com/google/googletest)
219299

220-
###### GStreamer Demo App
300+
###### GStreamer sample application dependencies
221301
* gstreamer - [License]( https://gstreamer.freedesktop.org/documentation/licensing.html)
222302
* gst-plugins-base
223303
* gst-plugins-good

0 commit comments

Comments
 (0)