Commit c6fcfc59 authored by Gojko Adzic's avatar Gojko Adzic

initial package

parents
build
*.pdf
*.png
*.svg
BASE_NAME=ffmpeg
DEPLOYMENT_BUCKET_NAME := desole-packaging
DEPLOYMENT_KEY := $(shell echo $(BASE_NAME)-$$RANDOM.zip)
STACK_NAME := $(BASE_NAME)-layer
clean:
rm -rf build
build/bin/ffmpeg:
mkdir -p build/bin
rm -rf build/ffmpeg*
cd build; \
curl https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-i686-static.tar.xz | tar x
mv build/ffmpeg*/ffmpeg build/ffmpeg*/ffprobe build/bin
build/layer.zip: build/bin/ffmpeg
cd build && zip -r layer.zip bin
# cloudformation has no support for packaging layers yet, so need to do this manually
#
build/output.yml: build/layer.zip cloudformation/template.yml
aws s3 cp build/layer.zip s3://$(DEPLOYMENT_BUCKET_NAME)/$(DEPLOYMENT_KEY)
sed "s:DEPLOYMENT_BUCKET_NAME:$(DEPLOYMENT_BUCKET_NAME):;s:DEPLOYMENT_KEY:$(DEPLOYMENT_KEY):" cloudformation/template.yml > build/output.yml
deploy: build/output.yml
aws cloudformation deploy --template-file build/output.yml --stack-name $(STACK_NAME)
aws cloudformation describe-stacks --stack-name $(STACK_NAME) --query Stacks[].Outputs[].OutputValue --output text
# FFmpeg/FFprobe AWS Lambda layer
This is an AWS Lambda layer containing statically linked `ffmpeg` and `ffprobe` binary utilities from the [`FFmpeg`](https://www.ffmpeg.org/) Linux package, allowing you to convert videos and extract metadata about video files in AWS Lambda, deployable as an AWS lambda layer. It can help you get started quickly with FFmpeg inside Lambda functions.
## Use within Lambda
You can use a pre-deployed ARN: `arn:aws:lambda:us-east-1:145266761615:layer:ffmpeg:1` or deploy yourself -- edit Makefile to set your deployment bucket etc, then just run `make deploy`.
The binares will be in `/opt/bin/ffmpeg` and `/opt/bin/ffprobe` inside your Lambda container.
## FFmpeg Version
This package includes FFmpeg 4.1, packaged by Johan Van Sickle. Please consider supporting him for maintaining statically built FFmpeg packages. For more information, check out <https://johnvansickle.com/ffmpeg/>
## Copyright and license
FFMpeg is licensed under [GNU GENERAL PUBLIC LICENSE 2.1 or later](https://www.ffmpeg.org/legal.html).
Description: FFMPEG AWS Lambda Layer
Parameters:
AllowedPrincipal:
Type: String
Description: Account principal allowed to deploy this layer
Default: '*'
Resources:
LambdaLayer:
Type: AWS::Lambda::LayerVersion
Properties:
CompatibleRuntimes:
- nodejs8.10
- python3.6
- ruby2.5
- java8
- go1.x
Description: FFMPEG for AWS Lambda
LayerName: ffmpeg
LicenseInfo: GPL-2.0-or-later
Content:
S3Bucket: DEPLOYMENT_BUCKET_NAME
S3Key: DEPLOYMENT_KEY
DeploymentPermission:
Type: "AWS::Lambda::LayerVersionPermission"
Properties:
Action: lambda:GetLayerVersion
LayerVersionArn: !Ref LambdaLayer
Principal: !Ref AllowedPrincipal
Outputs:
LambdaLayer:
Value: !Ref LambdaLayer
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment