Skip to main content

Guidance for Deploying Smart Cameras Using Amazon Kinesis Video Streams with WebRTC

Overview

This Guidance demonstrates how to use Amazon Kinesis Video Streams with WebRTC to enable low-latency, bi-directional, peer-to-peer video streaming from home surveillance cameras. Kinesis Video Streams, a managed service for real-time video processing, can store video and other media files for replay and analytics, while WebRTC facilitates direct, low-latency connections between the camera and client applications. This Guidance allows seamless, responsive home monitoring from mobile devices or web browsers, as the peer-to-peer WebRTC connection minimizes latency and bandwidth compared to traditional client-server streaming. It also includes sample applications with the included software development kit (SDK). Camera manufacturers and connected home providers can use the SDK as a starting point to build custom camera management and viewing experiences. This helps them to more easily integrate high-quality, low-latency video capabilities into their connected home offerings and provides consumers with a reliable home monitoring experience.

How it works

Live View Smart Home Surveillance Cameras

This architecture diagram shows how use Kinesis Video Streams for WebRTC, allowing for the low-latency, bi-directional, peer-to-peer streaming of video from home surveillance cameras.

Architecture diagram illustrating an IoT camera streaming solution using AWS services including AWS IoT Core, Amazon S3, Amazon CloudFront, Amazon DynamoDB, AWS Lambda, Amazon Cognito, Amazon Kinesis Video Streams with WebRTC, and Amazon API Gateway. The diagram shows device authentication, data storage, owner lookup, signaling channel, and peer-to-peer video streaming from camera to mobile client via the AWS Cloud.

Smart Home Surveillance Camera

This architecture diagram shows how to stream video from smart home cameras to Kinesis Video Streams for storage, playback, and analytics. It also shows how to send push notifications to mobile application users to notify them of events.

Architecture diagram showing the deployment of smart home surveillance cameras using AWS services including Kinesis Video Streams with WebRTC, AWS IoT Core, Amazon SNS, Amazon DynamoDB, Lambda, Amazon Cognito, API Gateway, S3, and Rekognition. The diagram illustrates the flow of data from the camera through the AWS Cloud to the mobile client of the camera owner.

Well-Architected Pillars

The architecture diagram above is an example of a Solution created with Well-Architected best practices in mind. To be fully Well-Architected, you should follow as many Well-Architected best practices as possible.

This Guidance uses Kinesis Video Streams and AWS IoT Core, which allow users to identify ways of optimizing the location event ingestion workflow and ensure the workflow can scale in the event of a large influx of new events. For instance, Kinesis Video Streams sends metrics to Amazon CloudWatch, giving users visibility into video streaming data. In addition, AWS IoT Core sends metrics to CloudWatch to monitor incoming messages and alerts when ingestion stops or slows, indicating possible network or other issues. AWS IoT Core also provides fleet management capabilities to give operators insights into connected camera status.

Read the Operational Excellence whitepaper 

AWS Identity and Access Management (IAM) policies scope permissions for the required AWS services to the minimum level. Kinesis Video Streams allows scoping permissions to authorized users and devices; it also protects data at rest with AWS Key Management Service (AWS KMS) and in transit with TLS. Moreover, AWS IoT Core policies control device access to MQTT topics and cloud interactions. Finally, Amazon Cognito provides authentication and authorization controls for mobile applications.

Read the Security whitepaper 

Serverless services designed across multiple Availability Zones (AZs) provide resilience against a number of failures. Specifically, it helps to ensure data ingestion into AWS IoT Core, processing by Lambda, and storage in Amazon S3, which offers versioning, object lock, and lifecycle configuration for reliability.

DynamoDB provides features like on-demand backup, point-in-time recovery, and global tables for data sync. Also, Kinesis Video Streams is built on AWS Regions and AZs, which offer low-latency, high-throughput, and highly redundant networking. This allows applications and databases to automatically failover between AZs with higher availability, fault tolerance, and scalability than traditional data centers.

Read the Reliability whitepaper 

AWS IoT Core scales to accommodate increasing message ingestion while offering low latency. Lambda enables the configuration of concurrency reservations to reduce cold start times and enhance performance. And Kinesis Video Streams automatically provisions and scales all the necessary infrastructure to ingest streaming video data from millions of devices.

Read the Performance Efficiency whitepaper 

Kinesis Video Streams for WebRTC reduces the need for cloud-based video streaming through peer-to-peer connectivity while providing pay-as-you-go TURN service pricing when cloud streaming is required. AWS IoT Core scales pricing with usage, enabling ongoing cost optimization by identifying goals, measuring metrics, and making incremental improvements, aided by cost tagging and billing groups. Cloud storage with Amazon S3 enables agility and cost savings through unlimited scale, storage class selection, and features like the Amazon S3 Intelligent-Tiering storage class. Similarly, DynamoDB offers cost optimization through capacity modes, table classes, and cost allocation tags.

Read the Cost Optimization whitepaper 

The majority of services comprising this Guidance are constructed using serverless technologies, thereby reducing the required compute footprint. For instance, Lambda will only execute when invoked by AWS IoT Core, and Amazon S3 can use more energy-efficient storage volumes for long-term media storage, such as thumbnail preview images. By building upon serverless services, the overall compute usage can be diminished, enabling the construction of a fully event-driven architecture that scales up and down with traffic demands, consuming less energy during periods of lower ingestion.

Furthermore, employing Kinesis Video Streams eliminates the need to maintain steady-state applications running on instances, instead automatically provisioning and elastically scaling all the infrastructure required to ingest streaming video data from millions of devices.

Read the Sustainability whitepaper 

Additional Resources

These additional resources can assist in the development of both camera-side applications as well as web and mobile applications. Included are links to the associated GitHub repositories containing example applications.

Amazon Kinesis Video Streams

Using the C++ Producer Library »

This developer guide provides an overview of the C++ Producer Library for Amazon Kinesis Video Streams, including the key objects, features, and a 3-step procedure to use the SDK.

Using the C++ Producer SDK on Raspberry Pi »

This developer guide provides a step-by-step guide on how to set up and use the Amazon Kinesis Video Streams C++ Producer SDK on a Raspberry Pi device.

Using HLS in HTML and JavaScript »

This developer guide provides an example for how to use HTTP Live Streaming (HLS) to view Kinesis Video Streams, including how to retrieve an HLS streaming session URL, display the stream in a web page using various players, and troubleshoot common HLS playback issues.

Amazon Kinesis Video Streams WebRTC

WebRTC SDK in C for Embedded Devices »

This developer guide provides instructions on how to download, build, and run the Kinesis Video Streams with WebRTC SDK in C for embedded devices, including details on supported codecs and sample applications.

WebRTC SDK in JavaScript for Web Applications »

This developer guide provides instructions for installing, using, and customizing the Kinesis Video Streams with WebRTC SDK in JavaScript for web applications.

Android Sample Application »

iOS Sample Application »

These examples includes a framework for building mobile applications with WebRTC capabilities for Android and iOS, as well as integration with Amazon Kinesis Video Streams to enable real-time video streaming.

Disclaimer

The sample code; software libraries; command line tools; proofs of concept; templates; or other related technology (including any of the foregoing that are provided by our personnel) is provided to you as AWS Content under the AWS Customer Agreement, or the relevant written agreement between you and AWS (whichever applies). You should not use this AWS Content in your production accounts, or on production or other critical data. You are responsible for testing, securing, and optimizing the AWS Content, such as sample code, as appropriate for production grade use based on your specific quality control practices and standards. Deploying AWS Content may incur AWS charges for creating or using AWS chargeable resources, such as running Amazon EC2 instances or using Amazon S3 storage.References to third-party services or organizations in this Guidance do not imply an endorsement, sponsorship, or affiliation between Amazon or AWS and the third party. Guidance from AWS is a technical starting point, and you can customize your integration with third-party services when you deploy the architecture.