簡體   English   中英

無法在Moviepy中添加文本剪輯。 獲取與Imagemagic相關的錯誤

[英]Not able to add Text Clip in Moviepy. Getting error related to Imagemagic

我正在從這里https://github.com/Zulko/moviepy使用moviepy模塊用於python

我已經成功安裝了moviepy和必要的模塊。 但是,當我嘗試運行在視頻中添加文本剪輯的第一個示例時,出現了錯誤。

這是我的代碼和輸出。

碼:

    from moviepy.editor import *
clip = VideoFileClip("video1.mp4").subclip(50, 60)

txt_clip = TextClip("My Holidays 2013", fontsize=70, color='white')
txt_clip = txt_clip.set_pos('center').set_duration(10)

video = CompositeVideoClip([clip, txt_clip])
video.write_videofile("output.mp4")

**注意:

  • 當我在終端中鍵入convert時,Imagemagic已正確安裝,我得到了版本名稱。 如果沒有使用TextClip,我也可以完美地運行其他示例
  • 我正在使用python3的ubuntu 16.04

。**

輸出:

[MoviePy] This command returned an error !Traceback (most recent call last):
  File "/home/vega6-x3/.local/lib/python3.5/site-packages/moviepy/video/VideoClip.py", line 1220, in __init__
    subprocess_call(cmd, verbose=False )
  File "/home/vega6-x3/.local/lib/python3.5/site-packages/moviepy/tools.py", line 49, in subprocess_call
    raise IOError(err.decode('utf8'))
OSError: convert: not authorized `@/tmp/tmpfa42vkjy.txt' @ error/property.c/InterpretImageProperties/3405.
convert: no images defined `PNG32:/tmp/tmpevkkuuf5.png' @ error/convert.c/ConvertImageCommand/3210.


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/vega6-x3/python/hello.py", line 10, in <module>
    txt_clip = TextClip("My Holidays 2013", fontsize=70, color='white')
  File "/home/vega6-x3/.local/lib/python3.5/site-packages/moviepy/video/VideoClip.py", line 1229, in __init__
    raise IOError(error)
OSError: MoviePy Error: creation of None failed because of the following error:

convert: not authorized `@/tmp/tmpfa42vkjy.txt' @ error/property.c/InterpretImageProperties/3405.
convert: no images defined `PNG32:/tmp/tmpevkkuuf5.png' @ error/convert.c/ConvertImageCommand/3210.
.

.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

請讓我知道我在做什么錯。 我是python的新手,所以不確定我做錯了什么。 從我所能得到的不多,在我看來,這是一個權限問題,但對此絕對可以肯定。

謝謝阿迪

看起來txt格式在系統上被禁用( 由於安全問題 )。

您可以通過在policy.xml注釋掉下面的行來重新啟用它

<policy domain="coder" rights="none" pattern="TEXT" />

但是我不建議在接受公眾文件的系統上使用它!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM