Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
A

amazon-kinesis-video-streams-webrtc-sdk-c

> 开发工具
Open source

Amazon Kinesis Video Streams Webrtc SDK is for developers to install and customize realtime communication between devices and enable secure streaming of video,

1.2K stars0 likes0 views
WebsiteGitHub

About

Amazon Kinesis Video Streams Webrtc SDK is for developers to install and customize realtime communication between devices and enable secure streaming of video,

Amazon Kinesis Video Streams C WebRTC SDK

Pure C WebRTC Client for Amazon Kinesis Video Streams

Key Features • Build • Run • Documentation • Setup IoT • Use Pre-generated Certificates • Related • License

[!NOTE] We have switched from using the 'master' branch to the 'main' branch. Please update your references accordingly.

New feature announcements

Please refer to the release notes in Releases page

Key Features

  • Audio/Video Support
    • VP8
    • H264
    • Opus
    • G.711 PCM (A-law)
    • G.711 PCM (µ-law)
  • Developer Controlled Media Pipeline
    • Raw Media for Input/Output
    • Callbacks for Congestion Control, FIR and PLI (set on RtcRtpTransceiver)
  • DataChannels
  • NACKs
  • STUN/TURN Support
  • IPv4/IPv6
  • Signaling Client Included
    • KVS Provides STUN/TURN and Signaling Backend
    • Connect with Android/iOS/Web using pre-made samples
  • Storage for WebRTC [NEW]
    • Ingest media into a Kinesis Video Stream.
  • Portable
    • Tested on Linux/MacOS
    • Tested on x64, ARMv5
    • Build system designed for pleasant cross-compilation
  • Small Install Size
    • Sub 200k library size
    • OpenSSL, libsrtp, libjsmn, libusrsctp and libwebsockets dependencies.

Build

Download

To download run the following command:

bash
git clone https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c.git --single-branch -b main kvs-webrtc-sdk

You will also need to install pkg-config and CMake (requires 3.x, CMake 4.x is not yet supported) and a build environment

Configuring on Ubuntu / Unix

Create a build directory in the newly checked out repository, and execute CMake from it.

bash
mkdir -p kvs-webrtc-sdk/build; cd kvs-webrtc-sdk/build; cmake ..

We have provided an example of using GStreamer to capture/encode video, and then send via this library. This is only built if pkg-config finds GStreamer is installed on your system.

On Ubuntu and Raspberry Pi OS you can get the libraries by running

bash
sudo apt-get install cmake m4 pkg-config libssl-dev libcurl4-openssl-dev liblog4cplus-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-base-apps gstreamer1.0-plugins-bad gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-tools 

By default we download all the libraries from GitHub and build them locally, so should require nothing to be installed ahead of time. If you do wish to link to existing libraries you can use the following flags to customize your build.

Configuring on Windows

Install MS Visual Studio Community / Enterprise, Strawberry perl, and Chocolatey if not installed already

Get the libraries by running the following in powershell

bash
choco install gstreamer
choco install gstreamer-devel
curl.exe -o C:\tools\pthreads-w32-2-9-1-release.zip ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip
mkdir C:\tools\pthreads-w32-2-9-1-release\
Expand-Archive -Path C:\tools\pthreads-w32-2-9-1-release.zip -DestinationPath C:\tools\pthreads-w32-2-9-1-release

Modify the path to the downloaded and unzipped PThreads in cmake in build_windows_openssl.bat if needed / unzipped at a path other than the one mentioned above

bash
cmake -G "NMake Makefiles" -DBUILD_TEST=TRUE -DEXT_PTHREAD_INCLUDE_DIR="C:/tools/pthreads-w32-2-9-1-release/Pre-built.2/include/" -DEXT_PTHREAD_LIBRARIES="C:/tools/pthreads-w32-2-9-1-release/Pre-built.2/lib/x64/libpthreadGC2.a" ..

Modify the path to MSVC as well in the build_windows_openssl.bat if needed / installed a different version / location

bash
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64

Allow long paths before we start the build

bash
git config --system core.longpaths true

Note that if the paths are still too long (which can cause the build to fail unfortunately), we recommend renaming the folders to use shorter names and moving them to C:/

Build the SDK

bash
.github\build_windows_openssl.bat

To run the sample application, make sure that you've exported the following paths and appended them to env:Path for powershell

bash
$env:Path += ';C:\webrtc\open-source\bin;C:\tools\pthreads-w32-2-9-1-release\Pre-built.2\dll\x64;C:\webrtc\build'

Dependency requirements

These would be applicable if the SDK is being linked with system dependencies instead of building from source by the SDK. libmbedtls: >= 2.25.0 (default: 3.6.x — see mbedTLS build matrix below) libopenssl: = 1.1.1x or >= 3.0.0 libsrtp2 : = 4.2.0

mbedTLS build matrix

mbedTLS line Default Opt-in flag Notes
2.28.x — -DBUILD_OLD_MBEDTLS_VERSION=ON Legacy
3.6.x Yes (default)
4.x — -DUSE_MBEDTLS4=ON Implies -DUSE_LIBSRTP3=ON

mbedTLS 4 note — build prerequisites: the mbedTLS 4 line builds TF-PSA-Crypto from source, whose code generation needs Python 3 (3.8+) with the jinja2 and jsonschema modules available at configure time:

bash
pip install jinja2 jsonschema

Without them the mbedTLS 4 dependency build fails with ModuleNotFoundError: No module named 'jinja2' (or 'jsonschema').

mbedTLS 4 note — DTLS certificates: the SDK clones the configured DTLS certificate key into each peer connection via PSA (mbedtls_pk_import_into_psa). Keys generated by the SDK (createRtcCertificate) set PSA_KEY_USAGE_EXPORT for this. If you supply your own RtcCertificate, its PSA key must also permit export, or copyCertificateAndKey() fails with STATUS_CERTIFICATE_GENERATION_FAILED.

[!NOTE] OpenSSL 3.x support was added in v1.20.0. The SDK still builds against 1.1.1t by default (OpenSSL 1.1.1 reached End-of-Life in September 2023). Enable 3.x by passing -DUSE_OPENSSL3=ON; when linking against a system OpenSSL that is already >= 3.0, the flag is auto-enabled. See Building against OpenSSL 3.x for details.

Cross-Compilation

If you wish to cross-compile CC and CXX are respected when building the library and all its dependencies. You will also need to set BUILD_OPENSSL_PLATFORM, BUILD_LIBSRTP_HOST_PLATFORM and BUILD_LIBSRTP_DESTINATION_PLATFORM. See our codecov.io for an example of this. Every commit is cross compiled to ensure that it continues to work.

Static Builds

If -DBUILD_STATIC_LIBS=TRUE then all dependencies and KVS WebRTC libraries will be built as static libraries.

CMake Arguments

You can pass the following options to cmake ..:

  • -DBUILD_SAMPLE -- Build the sample executables. ON by default.
  • -DIOT_CORE_ENABLE_CREDENTIALS -- Build the sample applications using IoT credentials. OFF by default.
  • -DENABLE_DATA_CHANNEL -- Build SDK & samples with data channel. ON by default.
  • -DMAX_SDP_SESSION_MEDIA_COUNT=N -- Maximum number of SDP media sections (m= lines). Default: 5. Each slot adds ~140 KB to the stack-allocated SessionDescription struct. See docs/SDP_LIMITS.md for details on what counts toward this limit and stack sizing guidance.
  • -DMAX_SDP_ATTRIBUTES_COUNT=N -- Maximum number of a= attributes per SDP section (session-level and each media section). Default: 256. Raise it (e.g. 320) to interoperate with browsers that send large recvonly offers. See docs/SDP_LIMITS.md for sizing guidance and memory implications.
  • -DBUILD_STATIC_LIBS -- Build all KVS WebRTC and third-party libraries as static libraries. Default: OFF (shared build).
  • -DADD_MUCLIBC -- Add -muclibc c flag
  • -DBUILD_DEPENDENCIES -- Whether or not to build depending libraries from source. ON by default.
  • -DBUILD_WEBSOCKETS -- Build libwebsockets from source. Defaults to value of BUILD_DEPENDENCIES.
  • -DBUILD_SRTP -- Build libsrtp from source. Defaults to value of BUILD_DEPENDENCIES.
  • -DUSE_LIBSRTP3 -- Build and link against libsrtp 3.x (cisco/libsrtp main, renamed to libsrtp3) instead of the long-standing 2.x default. OFF by default. The 3.x line adds PSA Crypto / mbedTLS 4 support but introduces public API breaks (opaque srtp_policy_t, separate src/dst buffers on srtp_protect/srtp_unprotect, separate master key + salt) — these are handled internally by the SDK. Use this if your platform requires mbedTLS 4 (e.g. ESP-IDF v6).
  • -DUSE_OPENSSL3 -- Build and link against OpenSSL 3.x (git tag openssl-3.5.7) instead of the default 1.1.1t (OpenSSL_1_1_1t). OFF by default. When linking against a system OpenSSL that is already >= 3.0, this flag is auto-enabled. The mbedTLS path is unaffected. See Building against OpenSSL 3.x for usage.
  • -DBUILD_USRSCTP -- Build libusrsctp from source. Defaults to value of BUILD_DEPENDENCIES.
  • -DBUILD_OPENSSL_PLATFORM -- If building OpenSSL what is the target platform
  • -DBUILD_LIBSRTP_HOST_PLATFORM -- If building LibSRTP what is the current platform
  • -DBUILD_LIBSRTP_DESTINATION_PLATFORM -- If building LibSRTP what is the destination platform
  • -DBUILD_TEST=TRUE -- Build unit/integration tests, may be useful for confirm support for your device. ./tst/webrtc_client_test
  • -DCODE_COVERAGE -- Enable coverage reporting
  • -DCOMPILER_WARNINGS -- Enable all compiler warnings
  • -DADDRESS_SANITIZER -- Build with AddressSanitizer
  • -DMEMORY_SANITIZER -- Build with MemorySanitizer
  • -DTHREAD_SANITIZER -- Build with ThreadSanitizer
  • -DUNDEFINED_BEHAVIOR_SANITIZER -- Build with UndefinedBehaviorSanitizer
  • -DCMAKE_BUILD_TYPE -- Build Release/Debug libraries. By default, the SDK generates Release build. The standard options are listed here
  • -DLINK_PROFILER -- Link with gperftools (available profiler options are listed here)
  • -DPKG_CONFIG_EXECUTABLE -- Set pkg config path. This might be required to find gstreamer's pkg config specifically on Windows.
  • -DENABLE_KVS_THREADPOOL -- Enable the KVS threadpool which is off by default.
  • -DENABLE_STATS_CALCULATION_CONTROL -- Enable the runtime control of ICE agent stats calculations.
  • -DINCREASE_PRECISION_TIMING_LOGS -- Default ON. ON=Use 2 decimals in PROFILE-logs timing. OFF=Truncates down to whole ms.
  • -DPRODUCER_C_VERSION_OVERRIDE -- Override KVS Producer-C version (git tag).
  • -DPIC_VERSION_OVERRIDE -- Override KVS PIC version (git tag).
  • -DPARALLEL_BUILD -- Build dependencies with multiple cores. OFF by default. Disabled on Windows.

These options get propagated to PIC:

  • -DKVS_STACK_SIZE -- Default stack size for threads created using THREAD_CREATE(), in bytes.

Buffer configuration:

  • -DKVS_SIGNALING_MESSAGE_LEN -- Maximum signaling message size in bytes (on-wire, including base64-encoded payload). Range: 10000-40000. Default: 18750. The decoded SDP buffer is automatically derived. See docs/SDP_LIMITS.md for details.

To clean up the open-source and build folders from previous build, use cmake --build . --target clean from the build folder

For windows builds, you will have to include additional flags for libwebsockets CMake. Add the following flags to your cmake command, or edit the CMake file in ./CMake/Depend

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Ckinesis-video-streamswebrtcwebrtc-sdk

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category开发工具
PricingOpen source

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具