For a whole video contaning many actors/speakers, we can just pull out snippets and create a video with those snippets so that it contains content from a single speaker/actor.
In this example, we are using this video: What is it like to be a Solution Architect and then we are extracting Lia's bit(snippets where she is present) by using her image. We have uploaded both(the video and Lia's image) in an s3 bucket and then use Amazon Rekognition to perform video editing.
- Have aws-cli installed
This is done in below Steps:
-
Create an s3 bucket manually and give a name. eg we are naming it :
my-rekognition-images
-
Add the video and referenced image that need to be searched in the video in the above created bucket. For this example I am uploading a video
SAs.mp4
andLia.JPG
-
Create an Elastic Transcoder Pipeline and provide the above s3 bucket as shown below:
-
Note the pipeline id by clicking the 'search icon' as shown below
-
Set up the infrastructure by launching the template in CloudFormation in your aws account and specify the
pieline-id
you got from step 3.- Note the
SNSArn
andRekognitionSNSPublishRoleArn
from theOutput
section in the CloudFormation stack
- Note the
-
Run the below commands in aws-cli
a. Create a collection
aws rekognition create-collection --collection-id my-collection --region ap-southeast-2
b. Add image/face to be indexed
aws rekognition index-faces --collection-id my-collection --image "S3Object={Bucket=my-rekognition-images,Name=Lia.JPG}" --external-image -id Lia --region ap-southeast-2
c. Start the face search in the video
aws rekognition start-face-search --video "S3Object={Bucket=my-rekognition-images,Name=SAs.mp4}" --collection-id my-collection --notification-channel '{\"SNSTopicArn\":\"<sns-topic-arn-found-at-step-5>\", \"RoleArn\":\"<role-arn-found-at-step-5>\"}' --region ap-southeast-2
This is an asyncronous process and once the job is done, Amazon Rekognition will trigger the SNS topic which in turn triggers the lambda function which will do the job for us and the output video
output.mp4
will be uploaded in themy-rekognition-images
s3 bucket
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.