, ,

Parsing Real-time AWS Kinesis Video Streams with Python

Blake Bradford Avatar

·

Parsing Real-time AWS Kinesis Video Streams with Python

Are you interested in working with real-time video streams from AWS Kinesis? Look no further! In this article, we will explore how to parse real-time AWS Kinesis Video Streams using a Python module called kvsparser.

Introduction to kvsparser

Source Code

kvsparser is a Python module specifically designed for parsing real-time AWS Kinesis Video Streams. It provides a convenient way to process and analyze segmented video fragments from Kinesis streams.

Usage

To get started with kvsparser, you need to install the module and import it into your Python project. Once imported, you can create an instance of the Parser class and pass the KinesisVideoMedia response object as a parameter. Here’s an example:

“`python
from kvsparser import Parser

for fragment in Parser(media):
print(fragment.class, “Frames”, len(fragment.images), “Tags”, fragment.tags)
“`

The Parser function returns an iterator of Fragment objects, which represent the segmented video fragments from AWS Kinesis Video Streams.

Understanding the Fragment Data Structure

Each Fragment object contains two main attributes: tags and images.

The tags attribute is a dictionary that provides metadata about the segmented video fragment. It includes the following information:

  • AWS_KINESISVIDEO_FRAGMENT_NUMBER: Number ID of the segmented video fragment.
  • AWS_KINESISVIDEO_SERVER_TIMESTAMP: Server timestamp of the segmented video fragment.
  • AWS_KINESISVIDEO_PRODUCER_TIMESTAMP: Producer timestamp of the segmented video fragment.

The images attribute is a list of NumPy ndarray objects representing the frames from the segmented video fragment.

License Information

kvsparser is licensed under the MIT No Attribution License. It is a derivative of the “Amazon Kinesis Video Streams Consumer Library For Python” by Dean Colcott. You can find the licensing details in the LICENSE file of the kvsparser repository.

Conclusion

In this article, we have explored how to parse real-time AWS Kinesis Video Streams using the kvsparser Python module. We have learned about the usage of the module, the data structure it returns, and the importance of licensing when working with open-source software.

If you are interested in working with real-time video streams from AWS Kinesis, give kvsparser a try. Its user-friendly interface and comprehensive data structure make it a valuable tool for processing and analyzing video fragments.

Feel free to reach out with any questions or comments. Happy parsing!

References:
kvsparser Repository
Amazon Kinesis Video Streams Consumer Library For Python

Leave a Reply

Your email address will not be published. Required fields are marked *