How awslabs/aws-streamer works
Project type and purpose
• The project is a collection of video processing and streaming tools designed for the AWS platform. It supports processing of video streams, live preview, video recording, ML inference, and integration with AWS services such as Kinesis Video Streams (KVS).
• It can work in a variety of deployment environments (edge, AWS Lambda, ECS, IoT Greengrass) so the design must account for both local processing and cloud integrations.
File structure
• The top-level files (Dockerfile, CMakeLists.txt, build.sh, setup.py) indicate that the project uses both Python and C/C++ (for GStreamer plugins) and supports containerized/cloud builds.
• The main source directory ("awstreamer") contains submodules like:
• gst_pipeline – for configuring and managing various GStreamer pipelines (e.g., appsrc, dvr, cv pipelines).
• gst_plugins – holds custom GStreamer plugins (with different implementations such as cvmlfilter, mxnet, and others in Python), indicating plug-in based modularity.
• gst_metadata – for handling metadata extraction or embedding, likely used during video stream processing.
• gst_configurer – provides functionality to generate and manage configurations for GStreamer based streaming.
• gst_viewer – for previewing streams in a browser, implying a web-based interface.
• utils – includes helper scripts for AWS integrations, GStreamer hacks, video processing, etc.
a. Core Components:
• Client/Controller Module: Represented by the main interface (awstreamer/client.py) that starts or schedules pipelines.
• Pipeline Manager: (awstreamer/gst_pipeline) Showing different pipeline types (appsrc_pipeline, dvr_pipeline, cv_pipeline, etc.) that perform the heavy lifting of streaming, processing, and content recording.
• GStreamer Plugins: Custom plugins under awstreamer/gst_plugins that provide specialized processing (e.g., ML inference with mxnet, image filtering with cvmlfilter, etc.).
• Configuration Utilities: (awstreamer/gst_configurer) for templating and setting up the pipelines dynamically via JSON configurations.
• Metadata and Utility Libraries: (awstreamer/gst_metadata and awstreamer/utils) handling stream meta information and common AWS or video processing functions.
b. AWS and External Services:
• External Tools: In the configuration, external dependencies such as DeepStream and locally installed OS packages are required.
Relationships and interactions
• Within the Pipeline Manager, show subdivisions for specific pipelines (e.g., video pipeline for streaming, DVR pipeline for recording, ML inference pipeline).
• Interactions between pipelines and GStreamer plugins. For example, an ML pipeline could route its video frames to the mxnet plugin or to the cvmlfilter.
• Demonstrate data flows where video input (camera streams, file sources) enter the pipeline, get processed (inference, filtering, segmentation), and then exit via different sinks (KVS, local storage, web viewer).
• Configuration component (gst_configurer) to both the client and pipeline manager, illustrating that JSON-defined configurations drive pipeline behavior.
• Utility components (aws.py, video.py) that support video file management (merging, file listing) and AWS integrations.
Architectural Patterns and Design Principles
• Modular Design: Highlight a plugin-based architecture where each GStreamer component or plugin is a self-contained module.
• Separation of Concerns: Clearly separate configuration, pipeline creation/management, processing (plugins), and utility functions.
• Scalability: Indicate that multiple pipelines can run concurrently and that the system is designed to scale across edge devices and cloud environments.
• Extensibility: The design should leave open “hooks” or extension points for custom plugins or configurations, as seen in the directory structure (especially the various plugin folders).