I'm trying to write a Python program that uses MoviePy on Mac OS 10.11.16 to convert an MP4 file to GIF. I use:
import moviepy.editor as mp
and I get an error saying I need to call imageio.plugins.ffmpeg.download()
so I can download ffmpeg. I use:
import imageio
imageio.plugins.ffmpeg.download()
which gives me the following error:
Imageio: 'ffmpeg.osx' was not found on your computer; downloading it now.
Error while fetching file: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)>.
Error while fetching file: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)>.
Error while fetching file: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)>.
Error while fetching file: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)>.
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
imageio.plugins.ffmpeg.download()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/imageio/plugins/ffmpeg.py", line 55, in download
get_remote_file('ffmpeg/' + FNAME_PER_PLATFORM[plat])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/imageio/core/fetching.py", line 121, in get_remote_file
_fetch_file(url, filename)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/imageio/core/fetching.py", line 177, in _fetch_file
os.path.basename(file_name))
OSError: Unable to download 'ffmpeg.osx'. Perhaps there is a no internet connection? If there is, please report this problem.
I definitely have an internet connection. I found this link, and tried installing with Homebrew and Static builds, but neither have worked. It seems like compiling it myself would be a little too advanced for me (I've only briefly looked into it). I used imageio.plugins.ffmpeg.download()
on IDLE. I read something about using PyCharm to run the MoviePy code, but I get the same initial error. ffmpeg is currently in my /usr/local/bin
folder. Any suggestions are welcome. Thank for your help.
Edit: I'm using Python 3.6.1
In Terminal, navigate to the folder containing the ffmpeg file using the "cd" (change directory) command. Type "cd" followed by the file path to your Downloads folder. For example, the path on my system is "/Users/aaron/Downloads".
manually download the built (this is where the SSL error occurs): https://github.com/imageio/imageio-binaries/raw/master/ffmpeg/ffmpeg-osx-v3.2.4
paste the file to the path: /Users/yourusername/Library/Application\ Support/imageio/ffmpeg/
re-run your code
movie.editor
imageio.plugins.ffmpeg.download()
brew install ffmpeg
I was able to solve this question using a solution similar to Bill Bell's. First, make sure that ffmpeg
is actually installed on your system by running brew install ffmpeg
. Then, running which ffmpeg
should return something like /usr/local/bin/ffmpeg
.
As Bill suggests, add FFMPEG_BINARY = "/usr/local/bin/ffmpeg"
before executing your python code or alternatively add:
import os
os.environ["FFMPEG_BINARY"] = "/usr/local/bin/ffmpeg"
in your code. These worked on my machine.
I warn you, I know nothing about Mac OS. But here's a possibility.
Look in config_defaults.py
, in the moviepy folder, which is where (on Linux and Windows) one can set the locations for certain executables.
Add the line
FFMPEG_BINARY = "/usr/local/bin/ffmpeg.osx"
to the bottom of the file, where I assume that ffmpeg.osx
is the name of your FFMPEG executable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With