Giter VIP home page Giter VIP logo

rikbrown / amazon-kinesis-video-streams-producer-sdk-java Goto Github PK

View Code? Open in Web Editor NEW

This project forked from awslabs/amazon-kinesis-video-streams-producer-sdk-java

2.0 2.0 1.0 68.35 MB

Allows developers to install and customize their connected camera and other devices to securely stream video, audio, and time-encoded data to Kinesis Video Streams

License: Other

Shell 0.22% Java 99.78%

amazon-kinesis-video-streams-producer-sdk-java's Introduction

Amazon Kinesis Video Streams Producer SDK Java

License

This library is licensed under the Amazon Software License.

Introduction

Amazon Kinesis Video Streams makes it easy to securely stream video from connected devices to AWS for analytics, machine learning (ML), and other processing.

The Amazon Kinesis Video Streams Producer SDK Java makes it easy to build an on-device application that securely connects to a video stream, and reliably publishes video and other media data to Kinesis Video Streams. It takes care of all the underlying tasks required to package the frames and fragments generated by the device's media pipeline. The SDK also handles stream creation, token rotation for secure and uninterrupted streaming, processing acknowledgements returned by Kinesis Video Streams, and other tasks.

Resources

Prerequisites

  • You can find available pre-built KinesisVideoProducerJNI library in src/main/resources/lib/ for Mac (x64), Ubuntu (x64) and Raspian (x86). If pre-built libraries did not work for you, "KinesisVideoProducerJNI" native library need to be built before running Java demo app.

Building from Source

Import the Maven project to your IDE, it will find dependency packages from Maven and build.

Examples

Launching Demoapp sample application

Run DemoAppMain.java in ./src/main/demo with JVM arguments set to

-Daws.accessKeyId={YourAwsAccessKey} -Daws.secretKey={YourAwsSecretKey} -Djava.library.path={NativeLibraryPath} 

for non-temporary AWS credential.

-Daws.accessKeyId={YourAwsAccessKey} -Daws.secretKey={YourAwsSecretKey} -Daws.sessionToken={YourAwsSessionToken} -Djava.library.path={NativeLibraryPath}

for temporary AWS credential.

Note: NativeLibraryPath must contain your "KinesisVideoProducerJNI" library. File name depends on your Operating System:

  • libKinesisVideoProducerJNI.so for Linux
  • libKinesisVideoProducerJNI.dylib for Mac OS
  • KinesisVideoProducerJNI.dll for Windows

If you are using pre-built libraries, please specify the path of library. Take pre-build library for Mac as example, you can specify src/resources/lib/mac as {NativeLibraryPath}.

Demo app will start running and putting sample video frames in a loop into Kinesis Video Streams. You can change your stream settings in DemoAppMain.java before you run the app.

Run the demo application from command line

If you want to run the DemoAppMain, follow the steps below.

Change the current working directory to

$ cd /<YOUR_FOLDER_PATH_WHERE_SDK_IS_DOWNLOADED>/amazon-kinesis-video-streams-producer-sdk-java/

Compile the Java SDK and Demoapp

$ mvn package

Create a temporary filename in /tmp directory

$ jar_files=$(mktemp)

Create classpath string of dependencies from the local repository to a file

$ mvn -Dmdep.outputFile=$jar_files dependency:build-classpath

Set the LD_LIBRARY_PATH to include the open source dependencies.

(refer: Kinesis Video Streams Producer SDK CPP

$ export LD_LIBRARY_PATH=/<YOUR_FOLDER_PATH_WHERE_SDK_IS_DOWNLOADED>/amazon-kinesis-video-streams-producer-sdk-cpp/kinesis-video-native-build/downloads/local/lib:$LD_LIBRARY_PATH
$ classpath_values=$(cat $jar_files)

Start the demo app

$ java -classpath target/kinesisvideo-java-demo-1.0-SNAPSHOT.jar:$classpath_values -Daws.accessKeyId=${ACCESS_KEY} -Daws.secretKey=${SECRET_KEY} -Djava.library.path=/opt/amazon-kinesis-video-streams-producer-sdk-cpp/kinesis-video-native-build com.amazonaws.kinesisvideo.demoapp.DemoAppMain

Run the demo application from Docker

Refer the README.md file in the dockerscripts folder for running the build and demo app within Docker container.

Launching PutMediaDemo sample application

Run PutMediaDemo.java to send sample mkv stream to Kinesis Video Streams. Note: ACCESS_KEY and SECRET_KEY are required for running this sample application as well. However, this demo application does not require JNI.

-Daws.accessKeyId={YourAwsAccessKey} -Daws.secretKey={YourAwsSecretKey} 

for non-temporary AWS credential.

-Daws.accessKeyId={YourAwsAccessKey} -Daws.secretKey={YourAwsSecretKey} -Daws.sessionToken={YourAwsSessionToken}

Pre-built KinesisVideoProducerJNI library supported platforms

  • Mac OS X (El capitan 10.11 or above)
  • Ubuntu (14.04 or above)
  • Raspian (9 stretch or above)

Additional Examples

For additional examples on using Kinesis Video Streams Java SDK and Kinesis Video Streams Parsing Library refer:

Troubleshooting

If you notice error in loading the native library (JNI), then check the output of ldd or otool

$ ldd libKinesisVideoProducerJNI.so

or in MacOS

$ otool -L libKinesisVideoProducerJNI.dylib

This will provide details on missing libraries during linking; If the output shows missing shared libraries, then run the following commands to clean the CMakeCache and link again.

rm -rf ./kinesis-video-native-build/CMakeCache.txt ./kinesis-video-native-build/CMakeFiles
 

and run ./install-script again.

./install-script

Also, set the LD_LIBRARY_PATH as below

export LD_LIBRARY_PATH=/<YOUR_PRODUCER_SDK_CPP_DOWNLOAD>/amazon-kinesis-video-streams-producer-sdk-cpp/kinesis-video-native-build/downloads/local/lib:$LD_LIBRARY_PATH

This should resolve native library loading issues.

Release Notes

Release 1.3.0 (15th March 2018)

  • Provide pre-built KinesisVideoProducerJNI library for Mac (x64), Ubuntu (x64) and Raspian (x86).
  • Remove Lombok dependency on Java Producer SDK.
  • Update instruction in README about KinsisVideoProducerJNI build.
  • Compatible changes in Java Adapter to work with latest changes in Kinesis Video Streams Producer SDK CPP.

Release 1.2.1 (February 2018)

  • Remove some unit tests relying on native library to avoid mvn package build (without -skipTests=true) failure.

Release 1.2.0 (February 2018)

  • Bug fixes and performance enhancement.
  • There are some interface changes to be compatible with native library changes.

Release 1.1.0 (December 2017)

  • Updated JNI code to expose ACKs as callbacks so developer can get more information about how the streaming is going.
  • The version of JNI is bumped to 1.2, this will require corresponding "KinesisVideoProducerJNI" with same version.

Release 1.0.0 (November 2017)

  • First release of the Amazon Kinesis Video Producer SDK Java.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.