无法在Moviepy中添加文本剪辑.获取与Imagemagic相关的错误 [英] Not able to add Text Clip in Moviepy. Getting error related to Imagemagic

查看:77
本文介绍了无法在Moviepy中添加文本剪辑.获取与Imagemagic相关的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从此处 https://github.com/Zulko/moviepy

我已经成功安装了moviepy和必要的模块.但是,当我尝试运行在视频中添加文本剪辑的第一个示例时,出现了错误.

这是我的代码和输出.

代码:

来自moviepy.editor导入的

  *剪辑= VideoFileClip("video1.mp4").subclip(50,60)txt_clip = TextClip(我的假期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") 

**注意:

  • 当我在终端我得到的版本名称.我也可以完美地运行另一个没有使用TextClip的例子
  • 我正在将ubuntu 16.04与python3一起使用

.**

输出:

  [MoviePy]此命令返回错误!回溯(最近一次通话):__init__中的文件"/home/vega6-x3/.local/lib/python3.5/site-packages/moviepy/video/VideoClip.py",第1220行subprocess_call(cmd,verbose = False)subprocess_call中的文件"/home/vega6-x3/.local/lib/python3.5/site-packages/moviepy/tools.py",第49行引发IOError(err.decode('utf8'))OSError:转换:未经授权的`@/tmp/tmpfa42vkjy.txt'@ error/property.c/InterpretImageProperties/3405.转换:未定义图像`PNG32:/tmp/tmpevkkuuf5.png'@ error/convert.c/ConvertImageCommand/3210.在处理上述异常期间,发生了另一个异常:追溯(最近一次通话):< module>中的文件"/home/vega6-x3/python/hello.py",第10行.txt_clip = TextClip(我的假期2013"​​,fontsize = 70,color ='white')__init__中的文件"/home/vega6-x3/.local/lib/python3.5/site-packages/moviepy/video/VideoClip.py",第1229行引发IOError(错误)OSError:MoviePy错误:由于以下错误,创建None失败:转换:未经授权的"@/tmp/tmpfa42vkjy.txt" @ error/property.c/InterpretImageProperties/3405.转换:未定义图像`PNG32:/tmp/tmpevkkuuf5.png'@ error/convert.c/ConvertImageCommand/3210...此错误可能是由于以下事实造成的:您的计算机上未安装ImageMagick,或者(对于Windows用户)未在文件conf.py中指定ImageMagick二进制文件的路径,或者.不正确的 

请让我知道我在做什么错.我是python的新手,所以不确定我做错了什么.从我所能得到的不多,在我看来,这是一个权限问题,但对此完全可以肯定.

谢谢阿迪

解决方案

好像在系统上禁用了 txt 格式(由于安全问题).

您可以通过在 policy.xml

中注释掉下面的行来重新启用它

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

但是我不建议在接受来自公众的文件的系统上使用它!

I am using the moviepy module for python from here https://github.com/Zulko/moviepy

I had successfully installed moviepy and necessary modules with it. But when I am trying to run the first example of adding Text clip in the video, I am getting error.

Here is my code and my output.

Code:

    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")

**NOTE:

  • Imagemagic is installed correctly as when i type convert in the terminal i get the version name. Also i can perfectly run the other examples were there isn't a use of TextClip
  • I am using ubuntu 16.04 with python3

.**

Output:

[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

Please let me know what wrong i am doing. I am pretty new to python, so not sure what i had done wrong. From what little i can get, it seems to me as a permission issue but exactly sure about this.

Thanks Adi

解决方案

Looks like the txt format is disabled on the system (due to security issues).

You can re-enable it by commenting out the line below in policy.xml

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

But I wouldn't recommend this on a system the accepts files from the public!

这篇关于无法在Moviepy中添加文本剪辑.获取与Imagemagic相关的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆