FFmpeg, SOX, Pandoc and RSVG for AWS Lambda

You can now use all the power of FFmpeg, SOX, Pandoc and RSVG to manipulate video, sound files, SVG images and text documents in Lambda functions, with just a few lines of code. We’ve pre-packaged four commonly used file conversion utilities into Lambda layers, which you can use with any serverless framework or deployment utility.

With low on-demand cost and scalability, cloud functions are ideal for file conversions. But for computationally intensive tasks, such as transcoding video, compiled code still rocks, and in most cases the best way of converting files is to just call into a standard Unix utility such as FFmpeg. The basic AWS Lambda container is quite constrained, and until recently it was relatively difficult to include additional binaries into Lambda functions. Lambda Layers make that easy.

A Layer is a common piece of code that is attached to your Lambda runtime in the /opt directory. You can reuse it in many functions, and deploy it only once. Individual functions do not need to include the layer code in their deployment packages, which means that the resulting functions are smaller and deploy faster. For example, at MindMup, we use Pandoc to convert markdown files into Word documents. The actual lambda function code is only a few dozen lines of JavaScript, but before layers, each deployment of the function had to include the whole Pandoc binary, larger than 100 MB. With a layer, we can publish Pandoc only once, so we use significantly less overall space for Lambda function versions. Each code change now requires just a quick redeployment.

And the best part of this is that you can also use Layers published by other people. Here are the four common Unix utility layers: you can build and deploy your own versions easily from Github, or just use the Layers we published directly: