Skip to content

Commit c6fcfc5

Browse files
committed
initial package
0 parents  commit c6fcfc5

File tree

4 files changed

+84
-0
lines changed

4 files changed

+84
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build
2+
*.pdf
3+
*.png
4+
*.svg

Makefile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
BASE_NAME=ffmpeg
2+
DEPLOYMENT_BUCKET_NAME := desole-packaging
3+
DEPLOYMENT_KEY := $(shell echo $(BASE_NAME)-$$RANDOM.zip)
4+
STACK_NAME := $(BASE_NAME)-layer
5+
6+
clean:
7+
rm -rf build
8+
9+
build/bin/ffmpeg:
10+
mkdir -p build/bin
11+
rm -rf build/ffmpeg*
12+
cd build; \
13+
curl https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-i686-static.tar.xz | tar x
14+
mv build/ffmpeg*/ffmpeg build/ffmpeg*/ffprobe build/bin
15+
16+
build/layer.zip: build/bin/ffmpeg
17+
cd build && zip -r layer.zip bin
18+
19+
# cloudformation has no support for packaging layers yet, so need to do this manually
20+
#
21+
build/output.yml: build/layer.zip cloudformation/template.yml
22+
aws s3 cp build/layer.zip s3://$(DEPLOYMENT_BUCKET_NAME)/$(DEPLOYMENT_KEY)
23+
sed "s:DEPLOYMENT_BUCKET_NAME:$(DEPLOYMENT_BUCKET_NAME):;s:DEPLOYMENT_KEY:$(DEPLOYMENT_KEY):" cloudformation/template.yml > build/output.yml
24+
25+
deploy: build/output.yml
26+
aws cloudformation deploy --template-file build/output.yml --stack-name $(STACK_NAME)
27+
aws cloudformation describe-stacks --stack-name $(STACK_NAME) --query Stacks[].Outputs[].OutputValue --output text
28+

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# FFmpeg/FFprobe AWS Lambda layer
2+
3+
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.
4+
5+
## Use within Lambda
6+
7+
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`.
8+
9+
The binares will be in `/opt/bin/ffmpeg` and `/opt/bin/ffprobe` inside your Lambda container.
10+
11+
## FFmpeg Version
12+
13+
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/>
14+
15+
## Copyright and license
16+
17+
FFMpeg is licensed under [GNU GENERAL PUBLIC LICENSE 2.1 or later](https://www.ffmpeg.org/legal.html).
18+

cloudformation/template.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Description: FFMPEG AWS Lambda Layer
2+
Parameters:
3+
AllowedPrincipal:
4+
Type: String
5+
Description: Account principal allowed to deploy this layer
6+
Default: '*'
7+
8+
Resources:
9+
LambdaLayer:
10+
Type: AWS::Lambda::LayerVersion
11+
Properties:
12+
CompatibleRuntimes:
13+
- nodejs8.10
14+
- python3.6
15+
- ruby2.5
16+
- java8
17+
- go1.x
18+
Description: FFMPEG for AWS Lambda
19+
LayerName: ffmpeg
20+
LicenseInfo: GPL-2.0-or-later
21+
Content:
22+
S3Bucket: DEPLOYMENT_BUCKET_NAME
23+
S3Key: DEPLOYMENT_KEY
24+
25+
DeploymentPermission:
26+
Type: "AWS::Lambda::LayerVersionPermission"
27+
Properties:
28+
Action: lambda:GetLayerVersion
29+
LayerVersionArn: !Ref LambdaLayer
30+
Principal: !Ref AllowedPrincipal
31+
32+
Outputs:
33+
LambdaLayer:
34+
Value: !Ref LambdaLayer

0 commit comments

Comments
 (0)