0

I have a local python script using moviepy that stitches together images to make a movie. I'd like to move this into a lambda function.

My approach has been to use AWS Cloud9 IDE to create the lambda. But I am stuck getting ffmpeg to work. moviepy is looking for ffmpeg, but I can't install it.

Specifically when running the function with just import moviepy, Cloud9 errors with

[ERROR] RuntimeError: No ffmpeg exe could be found. Install ffmpeg on your system, or set the IMAGEIO_FFMPEG_EXE environment variable.

And when trying to install ffmpeg (sudo yum install ffmpeg), Cloud9 prevents with the message

234 packages excluded due to repository priority protections

No package ffmpeg available.

How do I get Cloud9 to contain a usable ffmpeg that I can call in my python script? Or, alternatively, is there a more cloud-friendly way to stitch images to a video?

Update: installed binary, get similar error

Installing the binary lets me import moviepy and run commands. But on trying to write the result file, I get the following error

Moviepy - Building video ~/tmp/movie.mp4. Moviepy - Writing video ~/tmp/movie.mp4

[ERROR] FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/ffmpeg' Traceback (most recent call last):   File "/var/task/app.py", line 52, in lambda_handler     clip_looped.write_videofile('~/tmp/movie.mp4')   File "", line 2, in write_videofile   File "/var/task/moviepy/decorators.py", line 54, in requires_duration     return f(clip, *a, **k)   File "", line 2, in write_videofile   File "/var/task/moviepy/decorators.py", line 135, in use_clip_fps_by_default     return f(clip, *new_a, **new_kw)   File "", line 2, in write_videofile   File "/var/task/moviepy/decorators.py", line 22, in convert_masks_to_RGB     return f(clip, *a, **k)   File "/var/task/moviepy/video/VideoClip.py", line 300, in write_videofile     ffmpeg_write_video(self, filename, fps, codec,   File "/var/task/moviepy/video/io/ffmpeg_writer.py", line 213, in ffmpeg_write_video     with FFMPEG_VideoWriter(filename, clip.size, fps, codec = codec,   File "/var/task/moviepy/video/io/ffmpeg_writer.py", line 129, in init     self.proc = sp.Popen(cmd, **popen_params)   File "/var/lang/lib/python3.8/subprocess.py", line 858, in init     self._execute_child(args, executable, preexec_fn, close_fds,   File "/var/lang/lib/python3.8/subprocess.py", line 1704, in _execute_child     raise child_exception_type(errno_num, err_msg, err_filename)

ScottieB
  • 3,958
  • 6
  • 42
  • 60
  • 1
    I don't know much about cloud anything, but can you upload the ffmpeg binary (which you can download off ffmpeg.org) and set it up yourself? – kesh Mar 17 '22 at 02:47
  • I tried that, so now `moviepy` imports! And I can even run some commands (ImageSequenceClip) but saving (write_videofile) generates what seems like a similar error: No such file or directory: '/usr/bin/ffmpeg' – ScottieB Mar 18 '22 at 17:26
  • But when I got to /usr/bin, ffmpeg is there – ScottieB Mar 18 '22 at 17:26
  • 1
    Again it could be the file permission issue. Without seeing the exact error, you are likely writing your output file to a folder which ffmpeg cannot write to. – kesh Mar 18 '22 at 18:05
  • Added the error message in the question. Permissions would make sense, since it errors on the writing a new file. But the error states it can't find ffmpeg in the very place it is located. – ScottieB Mar 18 '22 at 18:35

0 Answers0