微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

由于 Imagemagick 出错,无法使用 moviepy 编写 textclip

如何解决由于 Imagemagick 出错,无法使用 moviepy 编写 textclip

我正在尝试将 TextClip 写入带有 moviepy 的视频。它一直在工作,但在我重新安装 ffmpeg 后,它不再工作(我不确定是否是它造成的,但我提到了它以防万一)。一些 TextClip 对象是纯空间。

我收到以下错误消息:

Traceback (most recent call last):
  File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\python38\site-packages\moviepy\video\VideoClip.py",line 1137,in __init__
    subprocess_call(cmd,logger=None)
  File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\python38\site-packages\moviepy\tools.py",line 54,in subprocess_call
    raise IOError(err.decode('utf8'))
OSError: magick.exe: no images for write '-write' 'PNG32:C:\Users\USER\AppData\Local\Temp\tmpmnf0fkb5.png' at CLI arg 14 @ error/operation.c/CLINoImageOperator/4893.


During handling of the above exception,another exception occurred:

Traceback (most recent call last):
  File "media_main_user.py",line 79,in <module>
    insert_audio_and_subtitles(input_clip,'output.mp4','text.mp3',subtitles,fontsize=subtitles_font_size,File "D:\UserData\Desktop\Project\影片剪輯\關鍵字版本\make_media.py",line 318,in insert_audio_and_subtitles
    annotated_clips = [annotate(video.subclip(from_t,to_t),txt) for (from_t,txt in subtitles]
  File "D:\UserData\Desktop\Project\影片剪輯\關鍵字版本\make_media.py",in <listcomp>
    annotated_clips = [annotate(video.subclip(from_t,line 311,in annotate
    txtclip = TextClip(txt,fontsize=fontsize,font=font,color=txt_color)
  File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\python38\site-packages\moviepy\video\VideoClip.py",line 1146,in __init__
    raise IOError(error)
OSError: MoviePy Error: creation of None Failed because of the following error:

magick.exe: no images for write '-write' 'PNG32:C:\Users\USER\AppData\Local\Temp\tmpmnf0fkb5.png' at CLI arg 14 @ error/operation.c/CLINoImageOperator/4893.
.

.This error can be due to the fact that ImageMagick is not installed on your computer,or (for Windows users) that you didn't specify the path to the ImageMagick binary in file conf.py,or that the path you specified is incorrect

我尝试了多种方法解决问题,例如检查moviepy安装目录中的config-default.py文件,并且它指向的ImageMagick路径没有错误。我尝试重新安装ImageMagick,它也没有用。我尝试将 ImageMagick 目录中的 policy.xml 文件none 编辑为 read|write,但它也不起作用。任何人都可以提出其他可能的解决方案吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。