Menu
Frame-based Analysis for Your Videos
Frame-based Analysis for Your Videos

Automated Deployment

Before you launch the automated deployment, please review the architecture, configuration, and other considerations discussed in this guide. Follow the step-by-step instructions in this section to configure and deploy the Frame-based Analysis for Your Videos solution into your account.

Time to deploy: Approximately 20 minutes

What We'll Cover

The procedure for deploying this architecture on AWS consists of the following steps. For detailed instructions, follow the links for each step.

Step 1. Launch the Stack

  • Launch the AWS CloudFormation template into your AWS account.

  • Enter values for required parameters: Video Bucket, Face Search Bucket, EC2 Key Name, and SSH Location.

  • Review the other template parameters, and adjust if necessary.

Step 2. Upload a Video for Processing

  • Upload a video to Amazon S3 and monitor the results.

Step 3. Perform a Facial Search

  • Upload a facial image to video metadata for matches.

Step 4. Search by Tag

  • Search for tags in the Amazon DynamoDB table.

Step 1. Launch the Stack

This automated AWS CloudFormation template deploys the Frame-based Analysis for Your Videos on the AWS Cloud.

Note

You are responsible for the cost of the AWS services used while running this solution. See the Cost section for more details. For full details, see the pricing webpage for each AWS service you will be using in this solution.

  1. Sign in to the AWS Management Console and click the button below to launch the video-frame-based-analysis AWS CloudFormation template.

    
                                 Frame-based Analysis for Your Videos launch button

    You can also download the template as a starting point for your own implementation.

  2. The template is launched in the US East (N. Virginia) Region by default. To launch the solution in a different AWS Region, use the region selector in the console navigation bar.

    Note

    This solution uses the Amazon Rekognition service, which is currently available in specific AWS Regions only. Therefore, you must launch this solution an AWS Region where Amazon Rekognition is available. For the most current service availability by region, see AWS service offerings by region.

  3. On the Select Template page, keep the default settings for the Choose a template and select Next.

  4. On the Specify Details page, assign a name to your solution stack.

  5. Under Parameters, review the parameters for the template and modify them as necessary. This solution uses the following default values.

    Parameter Default Description
    New Video Bucket <Requires input> Enter a unique bucket name for the Amazon S3 bucket the template will create to host videos for processing.
    New Face Search Bucket <Requires input> Enter a unique bucket name for the Amazon S3bucket that the template will create to host images used to search video metadata.
    EC2 Key Name <Requires input> The Amazon EC2 key pair that you will use to securely connect to your instance after it launches. When you created an AWS account, this is the key pair you created in your preferred AWS Region.
    SSH Location <Requires input> IP address range that can access the EC2 instances
    Min Videos 1 The minimum number of simultaneous videos that you want the solution to support. The template uses this value to configure the minimum size of the Auto Scaling group, which correlates to the minimum compute capacity required when scaling down.
    Max Videos 2 The maximum number of simultaneous videos that this solution should support. The template uses this value to configure the maximum size of the Auto Scaling group, which correlates to the maximum compute capacity required when scaling up.

    Note

    AWS recommends that you do not increase the default parameter beyond 2. If you choose to increase this parameter, you must request an increase to your AWS Lambda or Amazon Rekognition API limits, and configure your Amazon DynamoDB capacity to meet your parallel video processing requirements.

    Max Lambda Executions 20 The maximum number of Lambda functions used to process each video
    Lambda Log Level INFO The logging level for the Lambda functions. Info level includes error messages. Debug level shows information regarding Lambda function execution and includes info and error messages.
    Max Collection Size 100,000 The maximum number of faces to be indexed in each Amazon Rekognition collection
  6. Choose Next.

  7. On the Options page, choose Next.

  8. On the Review page, review and confirm the settings. Be sure to check the box acknowledging that the template will create AWS Identity and Access Management (IAM) resources.

  9. Choose Create to deploy the stack.

    You can view the status of the stack in the AWS CloudFormation console in the Status column. You should see a status of CREATE_COMPLETE in approximately 20 minutes.

    Note

    In addition to the primary AWS Lambda functions, this solution includes the solution-helper Lambda function, which runs only during initial configuration or when resources are updated or deleted.

    When running this solution, the solution-helper function is inactive. However, do not delete this function as it is necessary to manage associated resources.

Step 2. Upload a Video for Processing

After the solution successfully launches, you can start uploading MP4 video files for processing. The solution will process videos that you upload to the video Amazon S3 bucket, which you named in the New Video Bucket parameter in Step 1. You can upload videos using the AWS Console or AWS CLI.

Note

Do not use a prefix when you uplad videos to the S3 bucket.

The following example demonstrates how to use the AWS CLI to upload a video:

aws s3 cp video_file.mp4 s3://$video_bucket/ --metadata topic=iot-topic-name --sse AES256

After you upload a video, you can check the results in several different places. Processing log files are available in Amazon CloudWatch Logs under the video-frame-based-analysis-nodes log group. Check the preprocess.out.log and preprocess.err.log log streams for log information about FFmpeg preprocessing. You can also check for extracted frames; they are stored in the same bucket as your videos and have the prefix /images/$video_name.mp4/.

Video processing results are stored in the RVA_VIDEOS_RESULTS_TABLE, RVA_PROCESS_TABLE, and RVA_FRAMES_RESULTS_TABLE Amazon DynamoDB tables.

Step 3. Perform a Facial Search

After a video file is successfully processed, you have the option to upload a JPG image of a face and perform a facial search on your video metadata. The solution will process JPG images that you upload to the face search Amazon S3 bucket, which you named in the New Face Search Bucket parameter in Step 1. You can upload videos using the AWS Console or AWS CLI.

Note

This solution is configured to process images uploaded with an upload/ prefix.

The following example demonstrates how to use the AWS CLI to upload an image:

aws s3 cp video_face-image.jpg s3://$image_bucket/upload/ --metadata topic=iot-topic-name --sse AES256

Image search results are stored in Amazon DynamoDB tables. The svbp_processing table contains a mapping between a solution-created object ID and the original S3 image path. The svbp_results table contains image search results, including a list of the Amazon Rekognition collection, face ID, and Similarity score, for all video face collections containing faces that match the image. Empty results indicate that the image does not match any collections.

Step 4. Search by Tag

The solution creates tags with the timeline for each frame that is processed and consolidates the information. You can use these tags with your own custom search by tag user interface, or store them in Amazon Elasticsearch for future analysis.

Once a video is processed, navigate to the RVA_VIDEOS_LABELS_TABLE in Amazon DynamoDB. You can use this table to see the timeline of the tags in each video that is processed. The scan and filter options allow you to search all the uploaded videos for specific tags. Each Amazon DynamoDB item contains the video file, frame image name, labels detected by Amazon Rekognition, and the time (in milliseconds) where the frame image appears in the video. The tag results are uploaded to the Amazon S3 video bucket with a /labels/ prefix. Once the files are uploaded, an Amazon SNS topic notifies subscribed users of the location of the labels files.