This is a sample code to generate time-lapse video from Amazon Kinesis Video Streams.
- Python 3.6 or above
- opencv-python 4.5 or above
- boto3 1.22.7 or above
- A stream of Kinesis Video Streams with media ingested at that time
Python packages can be installed with pip3 install -r requirements.txt
.
If you are not familiar with Kinesis Video Streams, you can learn how it works. If you want to learn how to ingest media into Kinesis Video Streams, you can use Producer libraries.
If you haven't configured AWS credentials for boto3, please follow the instructions.
usage: main.py [-h] --stream-name STREAM_NAME --start-time START_TIME --end-time END_TIME
[--duration DURATION] [--framerate FRAMERATE] [--width WIDTH] [--height HEIGHT] --output-path OUTPUT_PATH
arguments:
-h, --help show this help message and exit
--stream-name STREAM_NAME Kinesis Video Streams stream name
--start-time START_TIME ISO format timestamp
--end-time END_TIME ISO format timestamp
--duration DURATION duration seconds of output video
--framerate FRAMERATE framerate of output video
--width WIDTH width of output video
--height HEIGHT height of output video
--output-path OUTPUT_PATH path to write output video
python3 main.py \
--stream-name my-kvs-stream \
--start-time 2022-01-01T00:00:00 \
--end-time 2022-01-01T09:00:00 \
--duration 3 \
--width 1920 \
--height 1080 \
--output-path result.mp4
This sample uses GetImages API to extract images from a Kinesis Video stream. Extracted images are combined and written as a mp4 video using OpenCV.
Please confirm Kinesis Video Streams pricing before using this sample. You will be charged for Kinesis Video Streams image generation depending on the number of images generated and its resolution.
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.