Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hasithaishere/aws-ffmpeg-lambda-layer

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.
https://github.com/hasithaishere/aws-ffmpeg-lambda-layer

amazon-linux audio aws custom-layer ffmpeg ffprobe lambda media-processing serverless video

Last synced: 3 months ago
JSON representation

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.

Awesome Lists containing this project

README

        

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](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html) 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:

```sh
make build
```

For Deploy the layer please use the following command:

```sh
make deploy AWS_REGION= 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.

```sh
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.

```sh
arn:aws:lambda:ap-southeast-1::layer:ffmpeg-lambda-layer:1
```

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

```yaml
Resources:
MediaConverterFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: media-converter/
Handler: app.lambdaHandler
Runtime: nodejs18.x
Timeout: 30
Layers:
- arn:aws:lambda:::layer:ffmpeg-lambda-layer:
```

## Author

[Hasitha Gamage](https://hasitha.xyz)

## License

* These Repository Code: [GPL v3](https://opensource.org/licenses/MIT)
* FFmpeg: GPLv2.1 , John Van Sickle's static build GPL v3