Macbook下ffmpeg下载失败问题解决
程序员文章站
2022-03-19 18:03:15
...
问题描述
在MacBook下pyCharm的Terminal使用
pip install moviepy
后,运行一段测试代码:
# coding: utf-8
from moviepy.editor import *
video = VideoFileClip("0.mp4")
result = CompositeVideoClip([video])
result.write_videofile("new.mp4")
发现提示错误:
Imageio: 'ffmpeg-osx-v3.2.4' was not found on your computer; downloading it now.
Error while fetching file: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)>.
Error while fetching file: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)>.
Error while fetching file: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)>.
Error while fetching file: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)>.
Traceback (most recent call last):
File "test_ffmpeg.py", line 3, in <module>
from moviepy.editor import *
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/moviepy/editor.py", line 30, in <module>
imageio.plugins.ffmpeg.download()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/imageio/plugins/ffmpeg.py", line 79, in download
get_remote_file(fname=fname, directory=directory, force_download=force_download)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/imageio/core/fetching.py", line 130, in get_remote_file
_fetch_file(url, filename)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/imageio/core/fetching.py", line 189, in _fetch_file
% os.path.basename(file_name)
IOError: Unable to download 'ffmpeg-osx-v3.2.4'. Perhaps there is a no internet connection? If there is, please report this problem.
根据提示逐个文件进行回溯,发现是因为imageio需要实时下载ffmpeg,但是该链接时常断掉,所以程序认为现在没网。
问题解决
事情变得明朗,我们只需要找到ffmpeg-osx-v3.2.4
是从哪里下载到哪里的,然后手动操作一次即可。
找到ffmpeg的资源:ffmpeg in github
在目录下找到需要的文件:ffmpeg-osx-v3.2.4
,下载到本地。
现在我们需要知道Macbook下应该把这个文件放到哪里,才能使得imageio
找到它并进行下一步操作。
根据错误提示,逐个回溯文件,到达fetching.py,发现
def _fetch_file(url, file_name, print_destination=True):
print(
"Imageio: %r was not found on your computer; "
"downloading it now." % os.path.basename(file_name)
)
这里会输出文件错误的信息,可见file_name
即为我们所需要的下载到本地的文件路径。修改代码:
def _fetch_file(url, file_name, print_destination=True):
print(
"Imageio: %r was not found on your computer; "
"downloading it now.\n %r"
% (os.path.basename(file_name), file_name)
)
再次运行测试代码(见上文),获取到本地的文件路径,把我们下载的ffmpeg-osx-v3.2.4
复制到对应目录:
cp -R /Users/_your_account_/Downloads/ffmpeg-osx-v3.2.4 /Users/_your_account_/Library/Application\ Support/imageio/ffmpeg/
再次运行测试代码,可以看到成功了。
上一篇: 浅析PHP中的闭包和匿名函数解释
下一篇: JSP转发和重定向是什么
推荐阅读
-
Android studio 下的APK打包失败问题解决办法
-
Android studio 下的APK打包失败问题解决办法
-
OS X Yosemite系统下载失败怎么办?OS X 10.10下载错误解决方法
-
Win10快速预览版升级Build 15055下载失败提示0x80070228的解决办法
-
PLSQL下载及配置oracle登录失败问题解决
-
PySide2下载安装问题(部分问题解决思路)
-
Datagrip2020下载MySQL驱动失败的问题
-
OS X Yosemite系统下载失败怎么办?OS X 10.10下载错误解决方法
-
详细介绍Linux服务器下PHPMailer发送邮件失败的问题解决
-
有关在Windows下配置PHP+Apache+Optimizer失败的问题解决方案_PHP教程