media-insights-on-aws

media-insights-on-aws

AWS媒体洞察 无服务器媒体处理应用程序开发框架

Media Insights on AWS是一个开发框架,用于构建处理多媒体内容的无服务器应用程序。该框架负责工作流编排和数据持久化,使开发者能专注于业务逻辑。它提供预构建的后端,加速应用开发,并已在广告投放、视频处理、内容索引和自动本地化等场景中得到应用。

Media Insights on AWS无服务器应用媒体处理工作流程编排AWS服务Github开源项目

scheduled-workflow release-workflow

Media Insights on AWS logo

Media Insights on AWS is a development framework for building serverless applications that process video, images, audio, and text on AWS. It takes care of workflow orchestration and data persistence so that you can focus on workflow development. By addressing the concerns of running workflows, Media Insights on AWS empowers you to build applications faster with the benefit of inheriting a pre-built and robust back end.

Media Insights on AWS has been successfully used in a variety of scenarios, such as:

  • Deriving video features for ad placement
  • Transforming video content with redaction
  • Indexing videos based on visual and audio content
  • Translating videos for automated localization

For additional details and sample use cases, refer to How to Rapidly Prototype Multimedia Applications on AWS with the Media Insights on AWS on the AWS Media blog.

This repository contains the Media Insights on AWS back-end framework. Users interact with the framework through REST APIs or by invoking Lambda functions directly. You will not find a graphical user interface (GUI) in this repository, but a reference application for Media Insights on AWS that includes a GUI is in the Content Localization repository.

Install

You can deploy Media Insights on AWS in your AWS account with the following Cloud Formation templates. The Cloud Formation stack name must be 12 or fewer characters long.

RegionLaunch
US East (N. Virginia)Launch in us-east-1
US West (Oregon)Launch in us-west-2
EU West (Ireland)Launch in eu-west-1

The Cloud Formation options for these one-click deploys are described in the installation parameters section.

Build from scratch:

Run the following commands to build and deploy Media Insights on AWS from scratch. Be sure to define values for MI_STACK_NAME and REGION first.

REGION=[specify a region]
MI_STACK_NAME=[specify a stack name]
git clone https://github.com/aws-solutions/media-insights-on-aws
cd media-insights-on-aws
cd deployment
VERSION=0.0.0
DATETIME=$(date '+%s')
DIST_OUTPUT_BUCKET=media-insights-on-aws-$DATETIME
aws s3 mb s3://$DIST_OUTPUT_BUCKET-$REGION --region $REGION
aws s3 mb s3://$DIST_OUTPUT_BUCKET --region $REGION
./build-s3-dist.sh --template-bucket $DIST_OUTPUT_BUCKET --code-bucket $DIST_OUTPUT_BUCKET --version $VERSION --region $REGION
TEMPLATE={copy "Template to deploy" link from output of build script}
aws cloudformation create-stack --stack-name $MI_STACK_NAME --template-url $TEMPLATE --region $REGION --capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND --disable-rollback

Outputs

If you're building applications on Media Insights on AWS then you will need to understand the following resources in the Outputs tab of the Cloud Formation stack:

  • DataplaneApiEndpoint is the endpoint for accessing dataplane APIs to create, update, delete and retrieve media assets
  • DataplaneBucket is the S3 bucket used to store derived media (derived assets) and raw analysis metadata created by the workflows.
  • WorkflowApiEndpoint is the endpoint for accessing the Workflow APIs to create, update, delete and execute the workflows.
  • WorkflowCustomResourceArn is the custom resource that can be used to create workflows in CloudFormation scripts

Cost

You are responsible for the cost of the AWS services used while running this solution. The cost for running this solution with the default settings in the us-east-1 (N. Virginia) region is approximately $24 per month without free tiers, or $13 per month with free tiers for 100 workflow runs. Most use cases are covered by the free tier for all AWS services except Amazon Kinesis and AWS Lambda. The costs for the Amazon Kinesis data stream ($12.56/mo) and the Workflow Scheduler lambda ($3.73/mo) will remain relatively unchanged, regardless of how many workflows execute.

Approximate monthly cost, excluding all free tiers:

AWS ServiceQuantityCost
Amazon API Gateway1 million workflows$3.50 / mo
Amazon Dynamo DB1 million workflows$.025 / mo
AWS Lambda100 workflows$4.75 / mo
Amazon Kinesis100 workflows$12.56 / mo
Amazon SQS1 million workflows$0.40 / mo
Amazon SNSn/aNo charge
Amazon S3100 workflows$2.3 / mo
AWS Xray100 workflows$.0005 / mo

These cost estimates are based on workflows processing live action videos 10 minutes in duration. Each additional 100 workflow executions will cost roughly $2, or higher for videos longer than 10 minutes and lower for videos shorter than 10 minutes.

Limitations

The Cloud Formation stack name for Media Insights on AWS must be 12 or fewer characters long. This will ensure all the resources in the stack remain under the maximum length allowed by Cloud Formation.

Media Insights on AWS does not inherently limit media attributes such as file size or video duration. Those limitations depend on the services used in user-defined workflows. For example, if a workflow uses Amazon Rekognition, then that workflow will be subject to the limitations listed in the guidelines and quotas for Amazon Rekognition. For those who use the Amazon Rekognition service within workflows, be aware about use cases that involve public safety and the general AWS Service Terms.

Architecture Overview

Deploying Media Insights on AWS builds the following environment in the AWS Cloud:

The AWS CloudFormation template provisions the following resources:

  1. Resource: An Amazon API Gateway resource for the control plane REST API

    Execution flow: This is the entry point where requests to create, read, update, delete (CRUD), or execute workflows begin.

  2. Resource: AWS Lambda and Amazon Simple Queue Service (Amazon SQS) resources to support workflow orchestration and translating user-defined workflows into AWS Step Functions

    Execution flow: Requests for workflow CRUD will finish in this step after an AWS Lambda function updates workflow related tables in DynamoDB. Requests to execute workflows will begin in this step by an AWS Lambda function that saves the request to an SQS queue, which is later read and executed by an AWS Lambda function (called, the workflow scheduler) that controls how many workflows can run at the same time.

  3. Resource: Amazon DynamoDB tables to store workflow-related data, such as state machine definitions for operators, workflow configurations, and workflow execution status.

  4. Resource: Step function resources in AWS Step Functions

    Execution flow: When a user defines a new workflow using the workflow API, then an AWS Lambda function creates an executable step function resource in AWS Step Function. When the workflow scheduler starts a workflow, it starts that step function resource, which then invokes a series of AWS Lambda functions that call external services and/or download results from those services. When all the AWS Lambda functions in a workflow have finished execution, then an AWS Lambda function is called to update the workflow status in Amazon DynamoDB.

  5. Resource: AWS Lambda functions for using the following commonly used services in workflows: Amazon Rekognition, Amazon Comprehend, Amazon Translate, Amazon Transcribe, Amazon Polly, and AWS Elemental MediaConvert

    Execution flow: Operators consist of AWS Lambda functions that call external services and/or download results from those services. They are invoked by a state machine in AWS Step Functions, as prescribed by the workflow definition. These AWS Lambda functions save results to long-term storage via the data plane REST API.

  6. Resource: An Amazon API Gateway resource for the data plane REST API

    Execution flow: Operators save results to long-term storage by calling this API.

  7. Resource: Amazon Simple Storage Service (Amazon S3), DynamoDB, and DynamoDB Streams for media and metadata data storage

    Execution flow: The AWS Lambda function behind the data plane API directly accesses Amazon S3 and Amazon DynamoDB to perform incoming CRUD requests. That AWS Lambda function saves files, such as binary media files or JSON metadata files, in Amazon S3. A pointer to those files is saved in an Amazon DynamoDB table. Finally, a time-ordered sequence of modifications to that table are saved in an Amazon DynamoDB Stream and an Amazon Kinesis Data stream.

  8. Resource: An Amazon Kinesis Data stream for interfacing with external applications

    Execution flow: The Amazon Kinesis Data Streams provides an interface for external applications to access data stored in the data plane. This interface is appropriate for feeding downstream data stores, such as the Amazon Elasticsearch Service or Amazon Neptune, that support specialized data access patterns required by end-user applications. In order to feed a downstream data store, you must implement a consumer (e.g. an AWS Lambda function) that consumes records from the data stream and performs the necessary extract, transform, and load (ETL) tasks needed for the external application.

NOTE: The ETL tasks that feed downstream data stores are entirely use-case dependent and therefore must be user-defined. The Implementation Guide includes detailed instructions for implementing ETL functions in Media Insights on AWS.

Architecture components:

  • Workflow API: Use the workflow API to create, update, delete, execute, and monitor workflows.

  • Control plane: The control plane includes the workflow API and state machines for workflows. Workflow state machines are composed of operators from the Media Insights on AWS operator library. When operators within the state machine are run, they interact with the Media Insights on AWS data plane to store and retrieve derived asset and metadata generated from the workflow.

    The control plane uses the following Amazon DynamoDB tables store workflow-related data:

    • Workflow – This table records user-defined workflows.
    • Workflow Execution – This table records the details of every workflow run.
    • Operations – This table records details for each operator in the operator library, such as references to Lambda functions and default runtime parameters.
    • Stage – This table records the auto-generated AWS Step Functions code needed for each operator.
    • System – This table records system-wide configurations, such as maximum concurrent workflows.
  • Operators: Operators are generated state machines that call AWS Lambda functions to perform media analysis or media transformation tasks. Users can define custom operators, but the Media Insights on AWS operator library includes the following pre-built operators:

    • Celebrity Recognition - An asynchronous operator to identify celebrities in a video using Amazon Rekognition.
    • Content Moderation - An asynchronous operator to identify unsafe content in videos using Amazon Rekognition.
    • Face Detection - An asynchronous operator to identify faces in videos using Amazon Rekognition.
    • Face Search - An asynchronous operator to identify faces from a custom face collection in videos using Amazon Rekognition.
    • Label Detection - An asynchronous operator to identify objects in a video using Amazon Rekognition.
    • Person Tracking - An asynchronous operator to identify people in a video using Amazon Rekognition.
    • Shot Detection - An asynchronous operator to identify camera shots in a video using Amazon Rekognition.
    • Text Detection – An asynchronous operator to identify text in a video using Amazon Rekognition.
    • Technical Cue Detection – An asynchronous operator to identify technical cues such as end credits, color bars, and black bars in a video using Amazon Rekognition.
    • Comprehend Key Phrases – An asynchronous operator to find key phrases in text using Amazon Comprehend.
    • Comprehend Entities – An asynchronous operator to find references to real-world objects, dates, and quantities in text using Amazon Comprehend.
    • Create SRT Captions – A synchronous operator to generate SRT formatted caption files from a video transcript generated by Amazon Transcribe.
    • Create VTT Captions - A synchronous operator to generate VTT formatted caption files from a video transcript generated by Amazon Transcribe.
    • Media Convert - An asynchronous operator to transcode input video into mpeg4 format using AWS Elemental MediaConvert.
    • Media Info – A synchronous operator to read technical tag data for video files.
    • Polly - An asynchronous operator that turns input text into speech using Amazon Polly.
    • Thumbnail - An asynchronous operator that generates thumbnail images for an input video file using AWS Elemental MediaConvert.
    • Transcribe - An asynchronous operator to convert input audio to text using Amazon Transcribe.
    • Translate - An asynchronous operator to translate input text using Amazon Translate.
  • Data plane: This stores the media assets and metadata generated by workflows. Implement a consumer of the Kinesis data stream in the data plane to extract, transform, and load (ETL) data from the master data store to downstream databases that support the data access patterns required by end-user applications.

  • Data plane API: This API is used to create, update, delete, and retrieve media assets and metadata.

  • Data plane pipeline: This pipeline stores metadata for an asset that can be retrieved using an object's AssetId and Metadata type. Writing data to the pipeline initiates a copy of the data to be stored in Kinesis Data Streams. This data stream is the interface that end-user applications can connect to use data stored in the data plane.

  • Data pipeline consumers: Changes to the data plane DynamoDB table are reflected in an Amazon Kinesis data stream. For each record in that stream, data pipeline consumers perform the necessary extract, transform, and load (ETL) tasks needed to replicate data, such as media metadata, to the data stores used by external applications. These ETL tasks are entirely use-case dependent and therefore must be user-defined. The Implementation Guide includes detailed instructions for implementing data pipeline consumers.

Installation Parameters

You can deploy Media Insights on AWS in your AWS account with the one-click deploy buttons shown above.

Required parameters

Stack Name: The name of the stack. This must be 12 or fewer characters long.

Optional parameters

ParameterDefaultDescription
MaxConcurrentWorkflows5Identifies the maximum number of workflows to run concurrently. When the maximum is reached, additional workflows are added to a wait queue. If too high, then workflows may fail due to external service quotas. Recommended range is 2 to 5.
DeployAnalyticsPipelinetrueDetermines whether to deploy a data streaming pipeline that can be consumed by external applications. By default, this capability is activated when the solution is deployed. Set to false to deactivate this capability.
DeployTestWorkflowfalseDetermines whether to deploy test resources that contain Lambda functions required for integration and end-to-end testing. By default, this capability is deactivated. Set to true to activate this capability.
EnableXrayTracefalseDetermines whether to activate Active Xray tracing on all entry points to the stack. By default, this capability is deactivated when the solution is deployed. Set to true to activate this capability.
ExternalBucketArn``The ARN for Amazon S3 resources that exist outside the stack which may need to be used as inputs to the workflows. The ARN must be a valid Amazon S3 ARN and must reference the same AWS account that is used for the stack. By default, ExternalBucketArn will be blank, meaning workflows will only be able to input media files from the data plane bucket.

Developers

Join our Gitter chat at https://gitter.im/awslabs/aws-media-insights-engine! This public chat forum was created to foster communication between Media Insights on AWS developers worldwide.

Gitter chat

For instructions on how to build applications with Media Insights on AWS, read the API reference and builder's guide in the Implementation Guide.

Security

Media Insights on AWS uses AWS_IAM to authorize REST API requests. The following screenshot shows how to test authentication to the Media Insights on AWS API using Postman. Be sure to specify the AccessKey and SecretKey for your own AWS environment.

<img src="docs/assets/images/sample_postman.png" width=600>

For more information, see the Implementation Guide.

S3 Macie

Amazon Macie can help you discover and protect sensitive data in AWS. If your use-case generates and stores sensitive data to Amazon S3, we recommend that you

编辑推荐精选

扣子-AI办公

扣子-AI办公

职场AI,就用扣子

AI办公助手,复杂任务高效处理。办公效率低?扣子空间AI助手支持播客生成、PPT制作、网页开发及报告写作,覆盖科研、商业、舆情等领域的专家Agent 7x24小时响应,生活工作无缝切换,提升50%效率!

堆友

堆友

多风格AI绘画神器

堆友平台由阿里巴巴设计团队创建,作为一款AI驱动的设计工具,专为设计师提供一站式增长服务。功能覆盖海量3D素材、AI绘画、实时渲染以及专业抠图,显著提升设计品质和效率。平台不仅提供工具,还是一个促进创意交流和个人发展的空间,界面友好,适合所有级别的设计师和创意工作者。

图像生成AI工具AI反应堆AI工具箱AI绘画GOAI艺术字堆友相机AI图像热门
码上飞

码上飞

零代码AI应用开发平台

零代码AI应用开发平台,用户只需一句话简单描述需求,AI能自动生成小程序、APP或H5网页应用,无需编写代码。

Vora

Vora

免费创建高清无水印Sora视频

Vora是一个免费创建高清无水印Sora视频的AI工具

Refly.AI

Refly.AI

最适合小白的AI自动化工作流平台

无需编码,轻松生成可复用、可变现的AI自动化工作流

酷表ChatExcel

酷表ChatExcel

大模型驱动的Excel数据处理工具

基于大模型交互的表格处理系统,允许用户通过对话方式完成数据整理和可视化分析。系统采用机器学习算法解析用户指令,自动执行排序、公式计算和数据透视等操作,支持多种文件格式导入导出。数据处理响应速度保持在0.8秒以内,支持超过100万行数据的即时分析。

AI工具酷表ChatExcelAI智能客服AI营销产品使用教程
TRAE编程

TRAE编程

AI辅助编程,代码自动修复

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

AI工具TraeAI IDE协作生产力转型热门
AIWritePaper论文写作

AIWritePaper论文写作

AI论文写作指导平台

AIWritePaper论文写作是一站式AI论文写作辅助工具,简化了选题、文献检索至论文撰写的整个过程。通过简单设定,平台可快速生成高质量论文大纲和全文,配合图表、参考文献等一应俱全,同时提供开题报告和答辩PPT等增值服务,保障数据安全,有效提升写作效率和论文质量。

AI辅助写作AI工具AI论文工具论文写作智能生成大纲数据安全AI助手热门
博思AIPPT

博思AIPPT

AI一键生成PPT,就用博思AIPPT!

博思AIPPT,新一代的AI生成PPT平台,支持智能生成PPT、AI美化PPT、文本&链接生成PPT、导入Word/PDF/Markdown文档生成PPT等,内置海量精美PPT模板,涵盖商务、教育、科技等不同风格,同时针对每个页面提供多种版式,一键自适应切换,完美适配各种办公场景。

AI办公办公工具AI工具博思AIPPTAI生成PPT智能排版海量精品模板AI创作热门
潮际好麦

潮际好麦

AI赋能电商视觉革命,一站式智能商拍平台

潮际好麦深耕服装行业,是国内AI试衣效果最好的软件。使用先进AIGC能力为电商卖家批量提供优质的、低成本的商拍图。合作品牌有Shein、Lazada、安踏、百丽等65个国内外头部品牌,以及国内10万+淘宝、天猫、京东等主流平台的品牌商家,为卖家节省将近85%的出图成本,提升约3倍出图效率,让品牌能够快速上架。

下拉加载更多