Select your cookie preferences

We use cookies and similar tools to enhance your experience, provide our services, deliver relevant advertising, and make improvements. Approved third parties also use these tools to help us deliver advertising and provide certain site features.

Distributed map state gif generator

Convert .mp4 and .mov files from S3 into multiple Gif animations for timeline scrubbing.

This application creates a Step Functions workflow with a distributed Map State that runs when a new movie file is uploaded to an S3 bucket. The Workflow runs multiple Lambda functions concurrently, each invocation is responsible for generating it's own .gif clip. A 1 hour movie takes about 4 seconds to generate 120 gifs.
the first Lambda function uses ffmpeg to work out how long the video is and how many chunks (gifs) will be needed for the whole video. The chunks are loaded into a MAP state. The next Lambda uses ffmpeg to build the .gifs.
Use the timeline scrubber applicaiton (link in resources section) to view the gif animation.
First, deploy this fmpeg Lambda layer.

Launch Stack

GitHub icon Visit the GitHub repo for this workflow.

< Back to workflows

Download

git clone https://github.com/aws-samples/step-functions-workflows-collection/tree/main/distributed-map-state-gif-generator// cd step-functions-workflows-collection/distributed-map-state-gif-generator/

Deploy

1. First deploy the Fmpeg layer2. sam build3. sam deploy --guided


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

1. Delete the stack: sam delete.

Benjamin Smith

Presented by Benjamin Smith

Ben is a senior developer advocate for Serverless Applications at Amazon Web Services based in London, UK. Prior to joining AWS Ben worked in a number of different technical roles specializing in workflow Automation and web development.

Follow on LinkedIn