Amazon Kinesis Video Streams Media Interface provides abstract interfaces for board specific media APIs. This repository also contains boards sensors/encoder implementations for Amazon Kinesis Video Streams Producer and WebRTC with out-of-box samples.
Name | Description | CMake Parameter | Status |
---|---|---|---|
FILE | Dummy boards that can capture from sample frames | -DBOARD=FILE |
|
x86/x64 | Capture from V4L2 device or capture from sample frames | -DBOARD=V4L2 or -DBOARD=FILE |
|
Raspberry Pi | Capture from V4L2 device or capture from sample frames | -DBOARD=V4L2 or -DBOARD=FILE |
|
Ingenic T31 | IPC SoC designed by Ingenic | -DBOARD=T31 |
|
Fullhan FH8626V100 | IPC SoC designed by Fullhan | -DBOARD=FH8626V100 |
|
Anyka AK3918 | IPC SoC designed by Anyka | -DBOARD=AK3918 |
|
Amlogic C302 | IPC SoC designed by Amlogic | -DBOARD=C302 |
|
Eeasy SV82x | IPC SoC designed by Eeasy | -DBOARD=SV82x |
- Prepare the AWS credentials
- If you want to use AWS access key id/access key secrets, you can generate AWS credentials by AWS IAM console.
- Alternatively if you want to use AWS IoT Certificate, you can generate AWS credentials by using this script
- Clone the code:
git clone https://github.com/aws-samples/amazon-kinesis-video-streams-media-interface.git
- Copy SoC SDK dependencies into 3rdparty/$BOARD/. See 3rdparty/README.md.
- Build the code:
export CC=${YOUR_C_TOOLCHAIN}
export CXX=${YOUR_CXX_TOOLCHAIN}
cd amazon-kinesis-video-streams-media-interface
mkdir build; cd build; cmake .. -DBOARD=${YOUR_BOARD_NAME}
make
-
Upload built artifacts(i.e kvswebrtcmaster-static) at amazon-kinesis-video-streams-media-interface/build/samples/webrtc/ to your board.
-
Setup AWS credentials in environment variables.
- If you want to use AWS access key id/access key secrets, use following commands to setup environment variables:
export AWS_KVS_LOG_LEVEL=2 export AWS_DEFAULT_REGION=us-east-1 export AWS_KVS_CACERT_PATH=rootca.pem export AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxxxxx export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Replace AWS_DEFAULT_REGION, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY with your own credentials
You can use Root CA in resources/certs/rootca.pem, or you can download it from Amazon Trust Services
- Alternatively if you want to use AWS IoT Certificate, turn on
IOT_CORE_ENABLE_CREDENTIALS
in Samples.h and using following commands to setup environment variables:
export AWS_KVS_LOG_LEVEL=2 export AWS_DEFAULT_REGION=us-east-1 export AWS_KVS_CACERT_PATH=rootca.pem export AWS_IOT_CORE_THING_NAME=your_camera_name export AWS_IOT_CORE_CREDENTIAL_ENDPOINT=xxxxxxxxxxxxxx.credentials.iot.us-east-1.amazonaws.com export AWS_IOT_CORE_CERT=your_camera_certificate.pem export AWS_IOT_CORE_PRIVATE_KEY=your_camera_private.key export AWS_IOT_CORE_ROLE_ALIAS=your_camera_role_alias
You can use Root CA in resources/certs/rootca.pem, or you can download it from Amazon Trust Services
-
Make sure your the system time on your board has been synchronized. You may set it manually or use ntp client.
-
If you are using access key id/access key secret, execute sample with channel name as parameter:
./kvswebrtcmaster-static your_channel_name
. If you are using AWS IoT Certificate, execute sample on your board directly:./kvswebrtcmaster-static
. -
Check WebRTC live stream via AWS console or AWS WebRTC test page
Browser should work as viewer mode during test.
- Clone the code:
git clone https://github.com/aws-samples/amazon-kinesis-video-streams-media-interface.git
- Copy SoC SDK dependencies into 3rdparty/$BOARD/. See 3rdparty/README.md.
- Build the code:
export CC=${YOUR_C_TOOLCHAIN}
export CXX=${YOUR_CXX_TOOLCHAIN}
cd amazon-kinesis-video-streams-media-interface
mkdir build; cd build; cmake .. -DBUILD_WEBRTC_SAMPLES=OFF -DBUILD_KVS_SAMPLES=ON -DBOARD=${YOUR_BOARD_NAME}
make
- Upload built artifacts(i.e kvsproducer-static) at amazon-kinesis-video-streams-media-interface/build/samples/kvs/ to your board.
- Setup AWS credentials.
- If you want to use AWS access key id/access key secrets, use following commands to setup environment variables:
export AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxxxxx
export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
export AWS_DEFAULT_REGION=us-east-1
- Alternatively if you want to use AWS IoT Certificate, add IoT Certificate into samples/kvsproducer/source/sample_config.h:
#define ENABLE_IOT_CREDENTIAL 1
#if ENABLE_IOT_CREDENTIAL
#define CREDENTIALS_HOST "xxxxxxxxxxxxxx.credentials.iot.us-east-1.amazonaws.com"
#define ROLE_ALIAS "KvsCameraIoTRoleAlias"
#define THING_NAME KVS_STREAM_NAME
#define ROOT_CA \
"-----BEGIN CERTIFICATE-----\n" \
"......\n" \
"-----END CERTIFICATE-----\n"
#define CERTIFICATE \
"-----BEGIN CERTIFICATE-----\n" \
"......\n" \
"-----END CERTIFICATE-----\n"
#define PRIVATE_KEY \
"-----BEGIN RSA PRIVATE KEY-----\n" \
"......\n" \
"-----END RSA PRIVATE KEY-----\n"
#endif /* ENABLE_IOT_CREDENTIAL */
- Make sure your the system time on your board has been synchronized. You may set it manually or use ntp client.
- Execute sample on your board:
./kvsproducer-static $YOUR_STREAM_NAME
- Check DASH live stream via AWS KVS test page
- Download video clips via AWS console.
In current stage, browser doesn't support G.711 via HLS/DASH. To verify audio content in G.711 formats, user must download video clips.
- Clone the code:
git clone https://github.com/aws-samples/amazon-kinesis-video-streams-media-interface.git
- Copy SoC SDK dependencies into 3rdparty/$BOARD/. See 3rdparty/README.md.
- Build the code:
export CC=${YOUR_C_TOOLCHAIN}
export CXX=${YOUR_CXX_TOOLCHAIN}
cd amazon-kinesis-video-streams-media-interface
mkdir build; cd build; cmake .. -DBUILD_WEBRTC_SAMPLES=OFF -DBUILD_SAVE_FRAME_SAMPLES=ON -DBOARD=${YOUR_BOARD_NAME}
make
- Execute sample on your board:
./saveframe-static $FILE_NAME
To cross compile FILE
board sample, user need to setup CC
, CXX
, USE_MUCLIBC
and BOARD_DESTINATION_PLATFORM
.
For ARM boards with uclibc:
export CC=${YOUR_C_TOOLCHAIN}
export CXX=${YOUR_CXX_TOOLCHAIN}
cd amazon-kinesis-video-streams-media-interface
mkdir build; cd build
cmake .. -DBOARD=FILE -DUSE_MUCLIBC=ON -DBOARD_DESTINATION_PLATFORM=arm-unknown-linux-uclibc
If board is using glibc, use cmake command
cmake .. -DBOARD=FILE -DUSE_MUCLIBC=OFF -DBOARD_DESTINATION_PLATFORM=arm-unknown-linux-gnu
instead.
For MIPS boards with uclibc:
export CC=${YOUR_C_TOOLCHAIN}
export CXX=${YOUR_CXX_TOOLCHAIN}
cd amazon-kinesis-video-streams-media-interface
mkdir build; cd build
cmake .. -DBOARD=FILE -DUSE_MUCLIBC=ON -DBOARD_DESTINATION_PLATFORM=mips-unknown-linux-uclibc
If board is using glibc, use cmake command
cmake .. -DBOARD=FILE -DUSE_MUCLIBC=OFF -DBOARD_DESTINATION_PLATFORM=mips-unknown-linux-gnu
instead.
To adapt other platforms SDKs with Amazon Kinesis Video Streams Media Interface, you need to implement interfaces in include/com/amazonaws/kinesis/video/capturer/VideoCapturer.h, include/com/amazonaws/kinesis/video/capturer/AudioCapturer.h and include/com/amazonaws/kinesis/video/player/AudioPlayer.h:
- VideoCapturer.h: abstract interfaces defined for video capturer sensor/encoder.
- AudioCapturer.h: abstract interfaces defined for audio capturer sensor/encoder.
- AudioPlayer.h: abstract interfaces defined for audio playback sensor/encoder.
The implementations of those interfaces should be put into source/${BOARD_NAME} and follow the name rules:
${BOARD_NAME}VideoCapturer.c
${BOARD_NAME}AudioCapturer.c
${BOARD_NAME}AudioPlayer.c
After implementation, you also need to create a platform specific CMake file in CMake named as ${BOARD_NAME}.cmake
:
if(BOARD STREQUAL "BOARD_NAME")
set(BOARD_SDK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/${BOARD})
# Add board related SDK sources here
set(BOARD_SRCS
)
# Add board related SDK header here
set(BOARD_INCS_DIR
${BOARD_SDK_DIR}/include/
${BOARD_SDK_DIR}/samples/libimp-samples/
)
# Add board related SDK lib here
set(BOARD_LIBS_SHARED
)
set(BOARD_LIBS_STATIC
)
endif()