在MacOS上为MoviePy安装ffmpeg失败,并显示SSL错误 [英] ffmpeg installation on macOS for MoviePy fails with SSL error
问题描述
我正在尝试编写一个Python程序,该程序在Mac OS 10.11.16上使用MoviePy将MP4文件转换为GIF.我使用:
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
,我收到一条错误消息,说我需要致电imageio.plugins.ffmpeg.download()
,以便我可以下载ffmpeg.我使用:
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()
这给了我以下错误:
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.
我肯定有互联网连接.我找到了此链接,并尝试使用Homebrew和Static版本进行安装,但均未成功.对于我自己来说,似乎编译起来有点太高级了(我只是简要地研究了一下).我在IDLE上使用了imageio.plugins.ffmpeg.download()
.我读到一些有关使用PyCharm运行MoviePy代码的信息,但出现相同的初始错误. ffmpeg当前在我的/usr/local/bin
文件夹中.欢迎任何建议.感谢您的帮助.
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.
我正在使用Python 3.6.1
I'm using Python 3.6.1
推荐答案
我能够通过调试提取脚本找到macOS的解决方法:
-
手动下载构建的文件(这是发生SSL错误的地方): https://github.com/imageio/imageio -binaries/raw/master/ffmpeg/ffmpeg-osx-v3.2.4
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
将文件粘贴到以下路径:/Users/yourusername/Library/Application\ Support/imageio/ffmpeg/
paste the file to the path: /Users/yourusername/Library/Application\ Support/imageio/ffmpeg/
重新运行代码
什么不能解决我的问题:
- 使用pip升级moviepy,然后通过导入
movie.editor
提示ffmpeg下载
- 明确导入imageio并执行
imageio.plugins.ffmpeg.download()
-
brew install ffmpeg
- upgrading moviepy with pip, then prompting the ffmpeg download through importing
movie.editor
- explicitly importing imageio and executing
imageio.plugins.ffmpeg.download()
brew install ffmpeg
what didn't solve my problem:
这篇关于在MacOS上为MoviePy安装ffmpeg失败,并显示SSL错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!