问题
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
回答1:
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!
来源:https://stackoverflow.com/questions/48578614/not-able-to-add-text-clip-in-moviepy-getting-error-related-to-imagemagic