gpt4 book ai didi

python - 由于 Imagemagick 的错误,无法用 moviepy 编写文本剪辑

转载 作者:行者123 更新时间:2023-12-04 23:20:37 32 4
gpt4 key购买 nike

我正在尝试将 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, to_t), txt in subtitles]
File "D:\UserData\Desktop\Project\影片剪輯\關鍵字版本\make_media.py", line 318, in <listcomp>
annotated_clips = [annotate(video.subclip(from_t, to_t), txt) for (from_t, to_t), txt in subtitles]
File "D:\UserData\Desktop\Project\影片剪輯\關鍵字版本\make_media.py", 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
我尝试了多种方法来解决问题,例如检查 config-default.py在moviepy安装目录下的文件,并且它指向的ImageMagick的路径没有错。我试图重新安装ImageMagick,它也没有用。我试图编辑 policy.xml ImageMagick 目录中的文件来自 noneread|write ,但它也不起作用。任何人都可以提出其他可能的解决方案吗?

最佳答案

/etc/ImageMagick-6/policy.xml尝试完全注释掉以下行:<policy domain="path" rights="none" pattern="@*" />像这样:<!-- <policy domain="path" rights="none" pattern="@*" /> -->

关于python - 由于 Imagemagick 的错误,无法用 moviepy 编写文本剪辑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67128786/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com