我正在尝试将 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 目录中的文件从none
to编辑read|write
,但它也不起作用。任何人都可以提出其他可能的解决方案吗?