Skip to content
Video processing using OpenCV and AWS Lambda
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Use opencv with AWS Lambda to do video processing, creating frames and storing it to destination S3 bucket.

🚀 Instructions

You can follow the steps below to deploy lambda function.

  1. Create AWS Lambda with Python 3.7.

  2. Attach role to AWS Lambda with permissions to Source bucket, Destination bucket and DynamoDB table. e.g.

    "Version": "2012-10-17",
    "Statement": [
            "Effect": "Allow",
            "Action": [
            "Resource": "*"
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
            "Resource": "*"
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": "s3:*",
            "Resource": [
            "Effect": "Allow",
            "Action": [
            "Resource": "dynamodbtable_arn"

Note: Make sure you select at least 1 GB of memory and 3-5 minutes of execution time to lambda as video procession takes time. Max video size < 500 MBs and max execution time < 15 minutes.

  1. Environment variables used are as follows:

For destination bucket:


For dynamodb table:

  1. In order to use OpenCV with AWS Lambda, you'll need to create layer with following package:

  1. Add the layer you created in the previous step to already created AWS Lambda.

Note: This lambda function supports only MP4 videos as of now.


Tested on this video:


Sample Video - 0 Sample Video - 1 Sample Video - 2 Sample Video - 3 Sample Video - 5

You can’t perform that action at this time.