amazon-kinesis-video-streams-producer-sdk-cpp
amazon-kinesis-video-streams-producer-sdk-cpp copied to clipboard
Add 'kvs_gstreamer_webcam.cpp' source code for webcam streaming
Issue #, if available: Not an issue but this is a newer version of a previous pull request (#1168) that I deleted (made a new fork because I had forked only the master branch by accident) so I can create a branch off the "develop" branch and merge into it. Description of changes: Added "kvs_gstreamer_webcam.cpp" source code file inside the "samples" directory. It provides a straightforward way to create a video stream from your built-in webcam to kinesis video streams that is tagged with event metadata for automatic image generation and suitable for use in an image generation configuration. The code builds the following pipeline: "gst-launch-1.0 autovideosrc ! videoconvert ! video/x-raw, format=I420,width=640,height=480,framerate=30/1 ! vtenc_h264_hw allow-frame-reordering=FALSE realtime=TRUE max-keyframe-interval=45 bitrate=500 ! h264parse ! video/x-h264,stream format=avc,alignment=au,profile=baseline ! appsink". The stream is also tagged with the appropriate metadata (as already mentioned). I also modified the "CMakeLists.txt" to compile the file into executables in the "build" folder with the rest of the sample ".cpp" files. It works great and is a straight-forward out-of-the-box solution to spin up a stream from your webcam to KVS and have it tagged with the appropriate metadata as well.
Recently I was creating a prototype for recognizing periodical screenshots from video stream data in KVS with Amazon Rekognition. I really needed to test the accuracy of the model and the only way I could test it into the dev stage was to use the web camera of my Mac. However, starting a stream through the command did not allow me to tag the frame with metadata for image generation. I could not find a trivial solution so I spent a few days on creating the "kvs_gstreamer_webcam.cpp" source code to solve my needs. While developing it I made sure to follow the structure of the rest of the "sample" files. It works great and is a straight-forward solution for anyone struggling with the same problems as I did for a long time.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Hi, thanks for your contribution.
I was trying to build it to confirm it works, but encountered this:
[ 95%] Building CXX object CMakeFiles/kvs_gstreamer_webcam.dir/samples/kvs_gstreamer_webcam.cpp.o
/Users/me/Downloads/amazon-kinesis-video-streams-producer-sdk-cpp/samples/kvs_gstreamer_webcam.cpp:298:41: error: no member named 'putEventMetadata' in 'com::amazonaws::kinesis::video::KinesisVideoStream'
data->kinesis_video_stream->putEventMetadata(STREAM_EVENT_TYPE_NOTIFICATION | STREAM_EVENT_TYPE_IMAGE_GENERATION, NULL);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
1 error generated.
make[2]: *** [CMakeFiles/kvs_gstreamer_webcam.dir/samples/kvs_gstreamer_webcam.cpp.o] Error 1
make[1]: *** [CMakeFiles/kvs_gstreamer_webcam.dir/all] Error 2
make: *** [all] Error 2