Skip to content

This repository hosts a custom AWS Lambda layer that includes static versions of FFmpeg and FFprobe utilities from the FFmpeg Linux package. These utilities are compatible with both Amazon Linux 2.x and Amazon Linux 1.x instances.

License

Notifications You must be signed in to change notification settings

hasithaishere/aws-ffmpeg-lambda-layer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FFmpeg/FFprobe AWS Lambda Layer
(Based on Amazon Linux 2)

This repository hosts a custom AWS Lambda layer that includes static versions of FFmpeg and FFprobe utilities from the FFmpeg Linux package. These utilities are compatible with both Amazon Linux 2.x and Amazon Linux 1.x instances.

Supported AWS

  • nodejs18.x
  • nodejs16.x
  • nodejs14.x
  • python3.11
  • java17
  • go1.x

Prerequisites

  • Unix Make environment
  • SAM CLI tool

Deploying to AWS as a layer

This layer can deployed in the AWS using following commands:

For Build the layer please use the following command:

make build

For Deploy the layer please use the following command:

make deploy AWS_REGION=<AWS_REGION> STACK_NAME=<STACK_NAME> 

By default, this uses ffmpeg-lambda-layer as the stack name. Provide a STACK_NAME variable when calling make deploy to use an alternative name.

And default region is ap-southeast-1 if you want to deploy in different region please provide AWS_REGION variable.

The ffmpeg and ffprobe binaries will be in /opt/bin/ after linking the layer to a Lambda function.

make deploy

This package includes FFmpeg 6.0, packaged by John Van Sickle. Please consider supporting him for maintaining statically built FFmpeg packages. For more information, check out https://johnvansickle.com/ffmpeg/

How to use

After deploy the layer, you can use the ARN of layer in your lambda function. It return the latest layer ARN, please check following screenshot.

arn:aws:lambda:ap-southeast-1:<AWS-ACCOUNT-ID>:layer:ffmpeg-lambda-layer:1  

You can use this ARN in your serverless function as following:

Resources:
  MediaConverterFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: media-converter/
      Handler: app.lambdaHandler
      Runtime: nodejs18.x
      Timeout: 30
      Layers:
        - arn:aws:lambda:<AWS-Region>:<AWS-Account-Id>:layer:ffmpeg-lambda-layer:<Layer-Version>

Author

Hasitha Gamage

License

About

This repository hosts a custom AWS Lambda layer that includes static versions of FFmpeg and FFprobe utilities from the FFmpeg Linux package. These utilities are compatible with both Amazon Linux 2.x and Amazon Linux 1.x instances.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published