FFmpeg on aws lambda – Invalid NAL unit size


I am trying to run below:

1- generate mp4 from one png image and a mp3 file

2- overlay another png image on top of the previous video

A-On my local environment (mac) things work perfect:



B- When I try the same on aws lambda , I get encoding erros and the overlay command fails. (Tried two different ffmpeg build on lambda, local build and official static 64bit build )




I know that it’s been quite some time since this question was asked but maybe it will help somebody anyway. I faced the same problem today with everything working on my mac and this kind of error on Lambda:

I added stdin=subprocess.DEVNULL to the subprocess call and videos encode properly now (as suggested by this answer)

Leave a Reply