This repository provides a Dockerized version of the AWS Kinesis Video Streams (KVS) WebRTC C SDK integrated with GStreamer. It allows users to stream video/audio to AWS KVS WebRTC, using customizable pipelines for different sources (e.g., USB cameras, IP cameras).
- Features
- Quick Start
- Prerequisites
- Configuration
- Usage
- Docker Hub Image
- Architecture
- Troubleshooting
- Contributing
- License
- Containerized Environment: Ensures consistent build and runtime across platforms
- AWS KVS WebRTC Integration: Low-latency, real-time video/audio streaming
- GStreamer Pipeline Support: Flexible video/audio capture and encoding options
- IoT Core Authentication: Secure device-to-cloud communication
- Multi-arch Support: x86_64 and ARM64 compatibility
- Optimized for Edge Devices: Efficient resource utilization
-
Clone the repository:
git clone https://github.com/sudoping01/aws-kvs-webrtc-stream-dockerised cd aws-kvs-webrtc-stream-dockerised
-
Configure AWS credentials:
cp certs/config.yaml.template certs/config.yaml # Edit certs/config.yaml with your AWS IoT credentials
-
Build and run:
docker-compose up --build
- Docker 20.10.0+
- Docker Compose 1.29.0+
- AWS Account with KVS and IoT Core access
- IoT Core device certificates
- Create a Kinesis Video Stream in your AWS Console
- Register an IoT thing and download certificates
- Create an IoT Role Alias for KVS access
-
Place IoT certificates in
certs/
:thing.cert.pem
thing.private.key
AmazonRootCA1.pem
-
Configure
certs/config.yaml
:endpoint: <iot-endpoint> credentialEndpoint: <credential-endpoint> thingName: <your-thing-name> roleAlias: <your-role-alias> rootCAFile: <your-root-ca-file> #AmazonRootCA1.pem certFile: <your-thing-cert-file> #thing.cert.pem privateKeyFile: <your-private-key-file> #thing.private.key
-
Adjust
docker-compose.yml
for your use case:environment: - AWS_DEFAULT_REGION=your_aws_region # if not set, the default is us-west-2 - CHANNEL_NAME=your_channel_name - PIPELINE=your_gstreamer_pipeline
-
Example of
gst pipeline
:-
camera usb :
v4l2src do-timestamp=TRUE device=/dev/video0 ! queue ! videoconvert ! video/x-raw,width=640,height=480,framerate=30/1 ! x264enc bframes=0 speed-preset=veryfast bitrate=512 byte-stream=true tune=zerolatency ! video/x-h264,stream-format=byte-stream,alignment=au,profile=baseline ! appsink sync=TRUE emit-signals=TRUE name=appsink-video
-
ip camera (brand IMOU):
rtspsrc location=rtsp://<user>:<password>@<ip>:554/cam/realmonitor?channel=1&subtype=1&unicast=false&proto=Onvif latency=0 short-header=TRUE ! rtph264depay !video/x-h264,stream-format=byte-stream,alignment=au,profile=baseline ! appsink sync=TRUE emit-signals=TRUE name=appsink-video
-
docker-compose up
- Open the KVS Console
- Select your stream
- Click "Start playback"
docker-compose down
We provide a pre-built Docker image on Docker Hub for convenience. You can pull and use this image instead of building it locally:
docker pull sudoping01/aws-kvs-webrtc-stream:latest
To run the container using the Docker Hub image:
docker run -it --device=/dev/video0 \
-v /path/to/your/certs:/certs \
-v /path/to/your/config.yaml:/certs/config.yaml \
-e AWS_DEFAULT_REGION=your_aws_region \
-e CHANNEL_NAME=your_channel_name \
-e PIPELINE="your_gstreamer_pipeline" \
sudoping01/aws-kvs-webrtc-stream:latest
For more information about using the Docker Hub image, including configuration details and examples, please visit our Docker Hub page.
graph TD
A[Edge Device] -->|Docker Container| B[KVS WebRTC SDK]
B --> C{AWS IoT Core}
C -->|Authentication| D[Kinesis Video Streams]
D --> E[Viewers]
Our solution encapsulates the KVS WebRTC SDK in a Docker container, leveraging IoT Core for secure authentication with AWS services.
Issue | Solution |
---|---|
Connection Failure | Verify AWS credentials and IoT certificates |
No Video | Check GStreamer pipeline and video device availability |
Poor Quality | Adjust bitrate and resolution in GStreamer pipeline |
For detailed logs:
docker-compose logs -f
We welcome contributions!
This project is licensed under the MIT License - see the LICENSE file for details.