AWS Rekognition - Setup

Rekognition


This document describes how to configure AWS Rekognition features in Accurate Video.

Storage and region


For rekognition to work, the source file must be located in a bucket whose region supports the rekognition service, i.e if we have an S3 bucket in Ireland (eu-west-1) we need to make sure that the rekognition job is started in Ireland as well. Make sure that rekognition is available at your intended region.

​In the context of Accurate Video this means that the storage containing the asset to be analyzed must be in the same region as the
job runner.

To control the region of the runner there are two options:
1. Deploy Accurate Video in aws-cloud in the desired region.
2. It is also possible to configure region and credentials with environment variables when starting the container. For more
information see AWS documentation

Permissions


The runner needs permissions to read the S3 bucket and to start rekognition jobs. This means that the IAM role associated with
the runner must have permissions AmazonRekognitionFullAccess and AmazonS3ReadOnlyAccess. More details on how to configure IAM
roles for rekognition can be found in the AWS documentation.

Roles and Permissions in AV.


A user can start an analysis job from Accurate Video if the user has one of the roles analysis_write or super_user.
The user also needs write access to the asset to be analyzed.

Results


The result from an analysis job will be stored on the asset as timespan metadata. Depending on the job that was run, these timespans will
either be of type REKOGNITION_SHOT or REKOGNITION_TECHNICAL_CUE and will have metadata fields:
- source - will always be set to REKOGNITION for rekognition jobs
- confidence - a number [0, 100]
- type - the detected type e.g. Shot, BlackFrames, ColorBars, EndCredits or Scene.

To view the new markers in the UI you will need some additional settings in the frontend settings, see example:

    markers: {
        groups: [
            ...
            {
                match: marker => marker?.metadata.get("source") === "REKOGNITION",
                title: "Rekognition",
                id: "Rekognition",
                readOnly: true,
                rows: [
                {
                    match: () => true, // Default
                    track: ({ metadata }) => metadata.get("name"),
                    title: ({ metadata }) => metadata.get("name"),
                    tooltip: ({ metadata }) =>
                    `${metadata.get("name")} ${metadata.get(
                        "description"
                    )}% confidence`
                }
                ],
                markerStyle: _ => ({ backgroundColor: "#ff9900" })
            },
            ...
        ],
    },
    markersMetadataSettings: [
      ....
      {
        match: type => type.startsWith("REKOGNITION_"),
        mappings: {
          name: "type",
          description: "confidence",
          trackId: "trackId"
        }
      },
      ...
Rendering using FFMPEG