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.

preguntada hace un año284 visualizaciones
1 Respuesta
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
respondido hace un año

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas