I have an issue with a Lambda function that tries to use ffmpeg as a third party on AWS. The function itself uses ffmpeg.js library which generates ffmpeg commands in it\'s
I successfully can work with ffmpeg on AWS Lambda in Python:
tar -zxvf ffmpeg-release-amd64-static.tar.xz
ffmpeg
(and optionally ffprobe
) from folder and delete rest of files.cd
into this folder and zip with zip -r -X "../archive.zip" *
In your Python code you need to set the correct filepath to the ffmpeg static build like so:
FFMPEG_STATIC = "/var/task/ffmpeg"
# now call ffmpeg with subprocess
import subprocess
subprocess.call([FFMPEG_STATIC, '-i', input_file, output_file])
I didn´t have to change any file permissions. This wouldn't have worked anyways because /var/task/
doesn't seem to be writeable.
input_file
and output_file
are local files in your spawned Lambda instance. I download my files from s3 to /tmp/
and do the processing with ffmpeg there. Make also sure to set sufficient memory and timeout for the Lambda (I use maximum settings for my workflow).