Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "webrtc-c/webrtc-and-directstream/amazon-kinesis-video-streams-producer-sdk-cpp"]
path = webrtc-c/webrtc-and-directstream/amazon-kinesis-video-streams-producer-sdk-cpp
url = https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp.git
[submodule "webrtc-c/webrtc-and-directstream/amazon-kinesis-video-streams-webrtc-sdk-c"]
path = webrtc-c/webrtc-and-directstream/amazon-kinesis-video-streams-webrtc-sdk-c
url = https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c.git
3 changes: 3 additions & 0 deletions webrtc-c/webrtc-and-directstream/.gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "amazon-kinesis-video-streams-producer-sdk-cpp"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems there are 2 .gitmodules files?

path = amazon-kinesis-video-streams-producer-sdk-cpp
url = https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp.git
94 changes: 94 additions & 0 deletions webrtc-c/webrtc-and-directstream/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# KVS WebRTC and Direct Stream Simultaneously
## Overview

Added a gstreamer app sample (`kvsWebRTCAndDirectStream.c`) to support streaming video to KVS with WebRTC SDK (for real-time use) and Stream Producer SDK (for video ingestion), simultaneously from 1 camera source.

This sample is currently only tested on Raspberry Pi 3B equipped with USB Camera.

## Prerequisites

- AWS Account with configured:
- Kinesis Video Streams
- IAM role with appropriate permissions
- **Physical webcam required**: The application uses `autovideosrc` and will not fallback to `videotestsrc` if no camera is connected

## Installation and Configuration

1. Clone this repository to your Raspberry Pi with submodules:
```
git clone --recurse-submodules https://github.com/aws-samples/amazon-kinesis-video-streams-demos.git
```

Or if already cloned, initialize submodules:
```
git submodule update --init --recursive
```

2. Copy the sample file to the WebRTC SDK samples directory:
```
cp kvsWebRTCAndDirectStream.c amazon-kinesis-video-streams-webrtc-sdk-c/samples/
```

3. Configure your AWS credentials on the Raspberry Pi

### Building the AWS SDKs

Refer to each SDK main repository for the details of how to build. `-DALIGNED_MEMORY_MODEL=ON` flag might need to be used on Raspberry Pi 4B and 5B.

- https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c
- https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp

#### Building the KVS Producer SDK

```
cd amazon-kinesis-video-streams-producer-sdk-cpp
mkdir -p build
cd build
cmake .. -DBUILD_DEPENDENCIES=OFF
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also need -DBUILB_GSTREAMER_PLUGIN=ON

make -j
```

#### Building the KVS WebRTC SDK

```
cd amazon-kinesis-video-streams-webrtc-sdk-c
mkdir -p build
cd build
cmake .. -DBUILD_DEPENDENCIES=OFF
make -j
```

## Usage

1. Configure your AWS credentials on the Raspberry Pi

2. Configure GStreamer plugin path with the path where you build the KVS Streams Producer app, e.g., `export GST_PLUGIN_PATH=/home/pi/amazon-kinesis-video-streams-producer-sdk-cpp/build`

3. Go to `amazon-kinesis-video-streams-webrtc-sdk-c/build/` and run `./samples/kvsWebRTCAndDirectStream <signaling channel name> <kvs stream name>`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I ran the make -j in the WebRTC-C build, I didn't see this file. This might require a modification to the CMakeLists to the samples directory to add the new executable.

https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c/blob/main/samples/CMakeLists.txt#L78

And it might need some linking to the GStreamer libraries since I am seeing these build issues:

  • "undefined reference to g_main_loop_quit"
  • "undefined reference to g_printerr"
  • "undefined reference to gst_element_factory_make"


## Screenshots

The following screenshots demonstrate WebRTC and Stream Producer running simultaneously:

### WebRTC Signaling Channel Viewer
![WebRTC Console View](screenshots/Screenshot-WebRTC.png)
*Real-time WebRTC streaming through the signaling channel*

### KVS Stream Viewer
![KVS Stream Console View](screenshots/Screenshot-KVSStream.png)
*Near real-time video ingestion to Kinesis Video Stream*

### Application Logs

#### WebRTC Logs
![WebRTC Logs](screenshots/Screenshot-Log-WebRTC.png)
*WebRTC connection and streaming logs*

#### KVS Stream Logs
![KVS Stream Logs 1](screenshots/Screenshot-Log-KVSStream-1.png)
![KVS Stream Logs 2](screenshots/Screenshot-Log-KVSStream-2.png)
*Kinesis Video Stream ingestion logs showing successful simultaneous operation*

Comment thread
sirknightj marked this conversation as resolved.
## License

This project uses components from AWS Kinesis Video Streams SDKs which are licensed under the Apache License 2.0.
Loading