moviepy: ImageMagick not detected by moviepy while using SubtitlesClip
ubuntu 16.04 python3.6
- Install apt-get -y install ffmpeg imagemagick
export FFMPEG_BINARY=‘/usr/bin/ffmpeg’ export IMAGEMAGICK_BINARY=‘/usr/bin/convert’
from moviepy.video.tools.subtitles import TextClip,SubtitlesClip
font="ArialUnicode"
color='white'
generator = lambda txt: TextClip(txt, font=font, fontsize=40, color=color)
subtitles = SubtitlesClip("big3.srt",generator)
- Error
[MoviePy] This command returned an error !--------------------------------------------------------
OSError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/moviepy/video/VideoClip.py in __init__(self, txt, filename, size, color, bg_color, fontsize, font, stroke_color, stroke_width, method, kerning, align, interline, tempfilename, temptxt, transparent, remove_temp, print_cmd)
1219 try:
-> 1220 subprocess_call(cmd, verbose=False )
1221 except (IOError,OSError) as err:
/usr/local/lib/python3.6/dist-packages/moviepy/tools.py in subprocess_call(cmd, verbose, errorprint)
48 verbose_print(errorprint, "\n[MoviePy] This command returned an error !")
---> 49 raise IOError(err.decode('utf8'))
50 else:
OSError: convert: not authorized `@/tmp/tmpatq66tt_.txt' @ error/property.c/InterpretImageProperties/3405.
convert: no images defined `PNG32:/tmp/tmp4uy8drq2.png' @ error/convert.c/ConvertImageCommand/3210.
During handling of the above exception, another exception occurred:
OSError Traceback (most recent call last)
<ipython-input-3-923a31c238ba> in <module>()
----> 1 subtitles = SubtitlesClip("big3.srt",generator)
/usr/local/lib/python3.6/dist-packages/moviepy/video/tools/subtitles.py in __init__(self, subtitles, make_textclip)
84
85 self.make_frame = make_frame
---> 86 hasmask = (self.make_textclip('T').mask is not None)
87 self.mask = (VideoClip(make_mask_frame, ismask=True) if hasmask else None)
88
<ipython-input-2-31100183c052> in <lambda>(txt)
1 font="ArialUnicode"
2 color='white'
----> 3 generator = lambda txt: TextClip(txt, font=font, fontsize=40, color=color)
/usr/local/lib/python3.6/dist-packages/moviepy/video/VideoClip.py in __init__(self, txt, filename, size, color, bg_color, fontsize, font, stroke_color, stroke_width, method, kerning, align, interline, tempfilename, temptxt, transparent, remove_temp, print_cmd)
1227 "path to the ImageMagick binary in file conf.py, or."
1228 "that the path you specified is incorrect" ))
-> 1229 raise IOError(error)
1230
1231 ImageClip.__init__(self, tempfilename, transparent=transparent)
OSError: MoviePy Error: creation of None failed because of the following error:
convert: not authorized `@/tmp/tmpatq66tt_.txt' @ error/property.c/InterpretImageProperties/3405.
convert: no images defined `PNG32:/tmp/tmp4uy8drq2.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
What should I do ?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 4
- Comments: 19
Commits related to this issue
- https://github.com/Zulko/moviepy/issues/693 — committed to mirrorhanyu/video-caption by mirrorhanyu 4 years ago
comment out (or remove the line that reads)
<policy domain="path" rights="none" pattern="@*" />
<!-- <policy domain="path" rights="none" pattern="@*" /> -->
The following code allows me to work with text via MoviePy from a fresh Google Colab instance.
Here
sed
is used to remove the line from thepolicy.xml
file.Check for the ImageMagick policy file. ImageMagick does not have the proper permission set: /etc/ImageMagick-6/policy.xml
Thank you ! it’s Working.
No more error!
Thank you so much @rikhuijzer that worked perfectly on my container 👍
Thanks @pkarp0 you made my day too 😃
Thank you for the reply @alvisanovari Just for anyone else who also need it for Google Colab or the local machine. I have uploaded the policy file here : policy.xml
So just use wget command to get the file and put it at /etc/ImageMagick-6/policy.xml location
install imagemagic: ! apt install imagemagick update the policy (see comments above about it) then import
I figured it out it had to be installed before importing moviepy
I am still getting this error even after removing the line? I am trying to run this on Google Colab. Any tips?