Installing ffmpeg on macOS for MoviePy fails with SSL error
I am trying to write a Python program that uses MoviePy for Mac OS 10.11.16 to convert an MP4 file to GIF. I use:
import moviepy.editor as mp
and I get a message that 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 to install using the Homebrew and Static compilations but none of them worked. It looks like compilation on its own would be too advanced for me (I only covered it briefly). I have used imageio.plugins.ffmpeg.download()
in IDLE. I read something about using PyCharm to run MoviePy code, but I get the same initial error. Ffmpeg is currently in my folder /usr/local/bin
. Any suggestions are greatly appreciated. Thanks for your help.
Edit: I am using Python 3.6.1
I managed to find a workaround for macOS by debugging the fetch script:
-
manually download the inline (SSL error occurs here): https://github.com/imageio/imageio-binaries/raw/master/ffmpeg/ffmpeg-osx-v3.2.4
-
paste the file into path:
/Users/yourusername/Library/Application\ Support/imageio/ffmpeg/
-
run your code
which didn't solve my problem:
- updating video with pip and then requesting ffmpeg download using import
movie.editor
- explicitly import imageio and execute
imageio.plugins.ffmpeg.download()
-
brew install ffmpeg
I warn you, I don't know anything about Mac OS. But there is a possibility here.
Look config_defaults.py
in the folder with the folder where (on Linux and Windows) you can set the locations for specific executable files.
Add the line
FFMPEG_BINARY = "/usr/local/bin/ffmpeg.osx"
at the bottom of the file where I assume ffmpeg.osx
is the name of the FFMPEG executable.