0

I am using the ffmpeg-cli-wrapper to run FFmpeg from an application I upload onto AWS lambda. I was initially getting the

error=13 Permission Denied

when trying to call it via the wrappers ProcessBuilder. My inital solution was to chmod 755 ffmpeg before uploading, but it didn't help.

For information, my FFmpeg and ffprobe files are located in the following classpath: static/ffmpeg/ffmpeg and static/ffmpeg/ffprobe. They are also statically linked.

AWS Lambda permission denied when trying to use ffmpeg

I've tried to follow the instructions given in the example above, but when I try to perform either mv or cp command:Runtime.exec("mv " + pathToFFmpeg + " /tmp"), I get the

error=20, Not a directory

error.

I know that I have the correct path for FFmpeg because the following command mv *pathToFFmpeg* *an arbitrary name* runs without error, meaning that the file is there and so the mv command just renames it as it's supposed to do.

Omar Riaz
  • 1
  • 1
  • The error doesn't seem to make sense, but your home directory is not writable, so moving shouldn't work. Try `cp`. – Michael - sqlbot Nov 11 '17 at 04:10
  • Well, I fixed this issue by switching over to `ProcessBuilder` (was using `Runtime.exec()` before). Now I'm getting `error=13, Permission denied` again when accessing ffmpeg in /tmp (even after `chmod 755` 'ing the files in /tmp), should i ask a new question for this? – Omar Riaz Nov 11 '17 at 08:46
  • I've fixed that issue as well now! I was initially `chmod 755`ing the files from windows 10 bash, but I found out that it had no afffect all along. I found a way to do the same thing in windows and now I can use FFmpeg. Thanks for your help! – Omar Riaz Nov 11 '17 at 09:09
  • Excellent. For the benefit of others experiencing the same issue, please write an answer describing exactly how you fixed it. – Michael - sqlbot Nov 11 '17 at 13:54
  • fosho, thanks again :) – Omar Riaz Nov 11 '17 at 22:42

1 Answers1

0

I was creating the JAR from a windows environment, and my understanding is that chmod 755'ing in the lambda environment had no effect because of this.

Solution: Before JARing in Windows, give permissions to the 'Everyone' group to the files, or to any directories that may contain. It didn't show up for me so I had to add the permission group. This seems to solve both the error=20 and error=13 errors that I was getting. Screenshot of menu. Note that I STILL had to include chmod 755 on lambda function or else I would get error=13 again.

I also ran into an error=2 (No such file or directory), which I've so far been able to resolve by:
a) Switching from Runtime.exec() to ProcessBuilder.
             (I suppose Runtime.exec() is less 'refined' and needs extra configuration)
b) Using cp rather than mv.
c) Running the ProcessBuilder from the same method I call FFmpeg from, rather than calling different methods of the same class to accomplish this. No clue why this is...

Omar Riaz
  • 1
  • 1