Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Install ffmpeg on aws lambda machine?

I'm trying to run a node js script on aws lambda that uses ffmpeg. To do this, I need to install ffmpeg on the machine itself.

I have looked trhough the documentation but I could not find how to connect to the machine that runs the lambda.

like image 510
Martin Blaustein Avatar asked Oct 31 '17 20:10

Martin Blaustein


1 Answers

This works for me in Python:

  1. Get static build of ffmpeg from here, as already mentioned by @Xeroxoid
  2. Untar with tar -zxvf ffmpeg-release-amd64-static.tar.xz
  3. Fetch file ffmpeg (and optionally ffprobe) from folder.
  4. Put bare ffmpeg file (without the subfolder) in the same folder as your lambda code.
  5. cd into this folder and zip with zip -r -X "../archive.zip" *
  6. Upload zipped file to AWS Lambda.

Set the correct filepath to ffmpeg like so:

FFMPEG_STATIC = "/var/task/ffmpeg"
import subprocess
subprocess.call([FFMPEG_STATIC, '-i', input_file, output_file])
like image 85
petezurich Avatar answered Nov 15 '22 12:11

petezurich