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)