Add 'kvs_gstreamer_webcam.cpp' source code for webcam streaming #1171
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.