We're trying to use ffmpeg via a function on AWS Lambda. We include ffmpeg and ffprobe in our include list so that the files are available when published, but we have to move them to somewhere inside the /tmp directory so that we can make them executable.
Currently we have code which will copy them to this folder, and then run chmod -R +x /tmp/ffmpeg to make the files in the folder executable. From there on it's fine, but it seems a bit excessive to have to perform this the first time the function is executed.
We've looked at the "scripts" option of the package.json file, and tried the following (amongst other things), but nothing seems to make a difference.
"scripts": {
"postpublish": [
"mkdir /tmp/ffmpeg",
]
}
I see that Amazon have suggested that people set permissions in the .zip file they upload so that the executables have the execute permission without being copied to a writeable folder and chmod'd, but we have two issues with this:
- We're using the Visual Studio tools from Amazon to publish.
- Only one proprietary format of zip (Info-Zip) seems to support permissions in zip files, and the last stable release of their software was 8 years ago.
Is there any way we can run some kind of post-publish script to copy and set permissions on the ffmpeg libraries?
Update: It seems that MacOS can generate a zip file with the permissions of the two executables, which is then honoured by Lambda. I'm still not sure how we can achieve this from Windows.