FFMpeg with lavfi on AWS lambda fails

0

I'm having an issue using lavfi in FFMpeg running on a lambda function. I've followed the directions here to install the John Van Sickle ffmpeg layer. I am able to do a simple convert command from python 3.9 via subprocess. So something like ffmpeg -i /tmp/in.mov /tmp/out.mp4 works fine.

Whenever I run a lavfi command via python3 subprocess

/opt/bin/ffmpeg -f lavfi -i movie=/tmp/test.ts[out0+subcc] -map 0:1 -f webvtt /tmp/test.vtt

The Lambda does not timeout but it does not create the /tmp/test.vtt file. If I list the tmp directory after the ffmpeg command but before the lambda finishes, I see that it creates an ffmpeg.core.## file where ## is a random number. I did a cat of that file and got a bunch of garbage. Is this a core dump because of a segmentation fault?

I can run the lavfi command above on an Amazon Linux ec2 with the same build of ffmpeg. Any thoughts on why this might be? Does lavfi require permissions to write a temp file to a directory other than tmp and that causes a write error? Trying to figure if there is any way I can get lavfi to work on lambda.

asked a year ago270 views
1 Answer
0

Hello,

Are you using the defaults for the lambda that you are creating? By default a lambda only allows 512 MB of space in the /tmp directory. https://docs.aws.amazon.com/lambda/latest/dg/configuration-function-common.html And only allocates 128MB of ram for your lambda function. https://docs.aws.amazon.com/lambda/latest/operatorguide/computing-power.html I could easily see you over running those limits and causing ffmpeg to core dump.

Hope this helps! Craig

profile pictureAWS
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions