用于MoviePy的macOS上的ffmpeg安装因SSL错误而失败

shm*_*ble 8 python macos ffmpeg moviepy python-imageio

我正在尝试编写一个在Mac OS 10.11.16上使用MoviePy将Python文件转换为GIF的Python程序.我用:

import moviepy.editor as mp
Run Code Online (Sandbox Code Playgroud)

我得到一个错误,说我需要打电话,imageio.plugins.ffmpeg.download()所以我可以下载ffmpeg.我用:

import imageio
imageio.plugins.ffmpeg.download()
Run Code Online (Sandbox Code Playgroud)

这给了我以下错误:

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.
Run Code Online (Sandbox Code Playgroud)

我绝对有互联网连接.我找到了这个链接,并尝试使用Homebrew和Static版本进行安装,但两者都没有用.似乎自己编译它对我来说有点太先进(我只是简单地研究过它).我用过imageio.plugins.ffmpeg.download()IDLE.我读了一些关于使用PyCharm来运行MoviePy代码的内容,但是我得到了相同的初始错误.ffmpeg目前在我的/usr/local/bin文件夹中.欢迎任何建议.谢谢您帮忙.

编辑:我正在使用Python 3.6.1

Fáb*_*bio 13

我通过调试获取脚本找到了macOS的解决方法:

  1. 手动下载建(这是那里的SSL错误发生时): https://github.com/imageio/imageio-binaries/raw/master/ffmpeg/ffmpeg-osx-v3.2.4

  2. 将文件粘贴到路径: /Users/yourusername/Library/Application\ Support/imageio/ffmpeg/

  3. 重新运行您的代码

什么没能解决我的问题:

  • 使用pip升级moviepy,然后通过导入提示ffmpeg下载 movie.editor
  • 显式导入imageio并执行 imageio.plugins.ffmpeg.download()
  • brew install ffmpeg


Bil*_*ell 1

我警告你,我对 Mac 操作系统一无所知。但这是一种可能性。

查看config_defaults.pymoviepy 文件夹中的 ,您可以在其中(在 Linux 和 Windows 上)设置某些可执行文件的位置。

添加行

FFMPEG_BINARY = "/usr/local/bin/ffmpeg.osx"
Run Code Online (Sandbox Code Playgroud)

到文件的底部,我假设这ffmpeg.osx是您的 FFMPEG 可执行文件的名称。