8

I am new to Linux. I installed ImageMagick as instruction on answer and it worked. But when I run my python code as below:

from moviepy.editor import *

clip = VideoFileClip("video.mkv").subclip(50,60)
clip = clip.volumex(0.8)
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("modifiedVideo.mp4")

it still gives me error like this:

[MoviePy] This command returned an error !Traceback (most recent call last):
  File "tst.py", line 5, in <module>
    txt_clip = TextClip("My Holidays 2013", fontsize = 70, color = 'white')
  File "/usr/local/lib/python2.7/dist-packages/moviepy/video/VideoClip.py", line 1145, in __init__
    raise IOError(error)
IOError: MoviePy Error: creation of None failed because of the following error:

convert: not authorized `@/tmp/tmp920Byo.txt' @ error/property.c/InterpretImageProperties/3405.
convert: no images defined `PNG32:/tmp/tmpUoKRUA.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

it says that ImageMagick is not installed on my computer(my current version of OS is Ubuntu 16.04 LTS, my python version is 2.7.12). Anyone gives me some help? Thx!

3 Answers 3

13

I have the same problem and I also try both answer of pauljohn32 but it does not work. However, I have solved the problem.

First of all, I install libmagick++-dev by using sudo apt install libmagick++-dev. Secondly, I follow the suggestion from reddit. Specifically, I open policy.xml of ImageMagick by using command: sudo vim /etc/ImageMagick-6/policy.xml and then comment the @ policy by change from <policy domain="path" rights="none" pattern="@*" /> to <!--<policy domain="path" rights="none" pattern="@*" /> -->.

I hope it works for your case

3

You may have ImageMagic VIEWER, but you probably lack the devel library that your Python program is looking for.

Here is the package listing from my system. You probably need several package. Look at the very end, for the Python bindings. I suspect if you install those, they will bring in the other requirements. I don't know how many other header files you need, but if you don't end up with libmagick++-dev, I'll be surprised.

$ dpkg -l | grep magic
ii  file                                              1:5.28-2ubuntu1                               amd64        Determines file type using "magic" numbers
ii  imagemagick                                                 8:6.8.9.9-7ubuntu8.2                          amd64        image manipulation programs -- binaries
ii  imagemagick-6.q16                                           8:6.8.9.9-7ubuntu8.2                          amd64        image manipulation programs -- quantum depth Q16
ii  imagemagick-common                                          8:6.8.9.9-7ubuntu8.2                          all          image manipulation programs -- infrastructure
ii  libgraphicsmagick-q16-3                                     1.3.25-1                                      amd64        format-independent image processing - C shared library
ii  libimage-magick-perl                                        8:6.8.9.9-7ubuntu8.2                          all          Perl interface to the ImageMagick graphics routines
ii  libimage-magick-q16-perl                                    8:6.8.9.9-7ubuntu8.2                          amd64        Perl interface to the ImageMagick graphics routines -- Q16 version
ii  libmagic1:amd64                                             1:5.28-2ubuntu1                               amd64        File type determination library using "magi" numbers
ii  libmagick++-6-headers                                       8:6.8.9.9-7ubuntu8.2                          all          object-oriented C++ interface to ImageMagick - header files
ii  libmagick++-6.q16-5v5:amd64                                 8:6.8.9.9-7ubuntu8.2                          amd64        object-oriented C++ interface to ImageMagick
ii  libmagick++-6.q16-dev:amd64                                 8:6.8.9.9-7ubuntu8.2                          amd64        object-oriented C++ interface to ImageMagick - development files
ii  libmagick++-dev                                             8:6.8.9.9-7ubuntu8.2                          all          object-oriented C++ interface to ImageMagick
ii  libmagickcore-6-arch-config:amd64                           8:6.8.9.9-7ubuntu8.2                          amd64        low-level image manipulation library - architecture header files
ii  libmagickcore-6-headers                                     8:6.8.9.9-7ubuntu8.2                          all          low-level image manipulation library - header files
ii  libmagickcore-6.q16-2:amd64                                 8:6.8.9.9-7ubuntu8.2                          amd64        low-level image manipulation library -- quantum depth Q16
ii  libmagickcore-6.q16-2-extra:amd64                           8:6.8.9.9-7ubuntu8.2                          amd64        low-level image manipulation library - extra codecs (Q16)
ii  libmagickcore-6.q16-dev:amd64                               8:6.8.9.9-7ubuntu8.2                          amd64        low-level image manipulation library - development files (Q16)
ii  libmagickwand-6-headers                                     8:6.8.9.9-7ubuntu8.2                          all          image manipulation library - headers files
ii  libmagickwand-6.q16-2:amd64                                 8:6.8.9.9-7ubuntu8.2                          amd64        image manipulation library
ii  libmagickwand-6.q16-dev:amd64                               8:6.8.9.9-7ubuntu8.2                          amd64        image manipulation library - development files
ii  libvariable-magic-perl                                      0.59-2                                        amd64        module to associate user-defined magic to variables from Perl
ii  python-magic                                                1:5.28-2ubuntu1                               all          File type determination library using "magi" numbers (Python bindings)
ii  python3-magic                                               1:5.28-2ubuntu1                               all          File type determination library using "magi" numbers (Python 3 bindings

Rather than install manually one by one with apt-get, I recommend novices install program "synaptic". It offers much better view of what there is and what you can get.

I'm looking in synaptic now, appears to me there are several other imagicmagick<->python packages. Look for "python-pythonmagic" or "python-wand". Appears to me there is plenty to explore.

1
  • I installed synaptic and using it to search and installed "python-pythonmagic" "python-wand". Then I go back to my terminal and try to run the python program, but it's still not working? what else can I do? Thanks!
    – Tony Chen
    Jan 18, 2017 at 5:34
1

Here's a different non-answer. I feel your pain. I should not have been so confident about the missing python devel stuff, that is the usual thing for new users.

Same problem discussed in this Reddit thread:

https://www.reddit.com/r/moviepy/comments/2q4754/need_help_with_installationconfiguration/

That's about MS Windows

The moviepy page https://github.com/Zulko/moviepy has same advice for windows users, but says Linux should work out of the box. I was confident thinking "I can make this work for my new friend..."

I've installed moviepy to see what it does. I did not have your video, I found a small thing "toystory.mp4" for testing (put a copy in http://pj.freefaculty.org/scraps if you want to try). This code is an example on their homepage: https://github.com/Zulko/moviepy

from moviepy.editor import *
video = VideoFileClip("toystory.mp4").subclip(50,60)
# Make the text. Many more options are available.
txt_clip = ( TextClip("Toy",fontsize=70,color='white')
         .set_position('center')
         .set_duration(10) )

result = CompositeVideoClip([video, txt_clip]) # Overlay text on video
result.write_videofile("toy.webm",fps=25)

I get same error you do:

>>> txt_clip = ( TextClip("Toy",fontsize=70,color='white')
...              .set_position('center')
...              .set_duration(10) )

[MoviePy] This command returned an error !Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/home/pauljohn/.local/lib/python2.7/site-packages/moviepy/video/VideoClip.py", line 1145, in __init__
 raise IOError(error)

IOError: MoviePy Error: creation of None failed because of the following error:

convert: not authorized `@/tmp/tmp8uDl3E.txt' @ error/property.c /InterpretImageProperties/3405.
convert: no images defined `PNG32:/tmp/tmprHOK9n.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

I thought to myself, "maybe I need to fix this like the Windows user"

from moviepy.config import change_settings
change_settings({"IMAGEMAGICK_BINARY": r"/usr/bin/convert"})

That fails the same way.

So I have no answer.

But I have a new guess. Now I suspect that the ImageMagick version we have is behaving in a way that moviepy does not expect. This triggers that unhelpful error message.

The right place to ask for help is in the moviepy. As long as you do have convert installed.

$ ls -la /usr/bin/convert
lrwxrwxrwx 1 root root 25 Jun 11  2016 /usr/bin/convert -> /etc/alternatives/convert

$ ls -la /etc/alternatives/convert
lrwxrwxrwx 1 root root 20 Jun 11  2016 /etc/alternatives/convert -> /usr/bin/convert-im6

I've got convert-im6, that's pointed at by /usr/bin/convert. If that version is too new, that could cause problem you see. Sorry that's the best I can do.

If you get answer, don't forget to let us know the answer.

1
  • Thank you vary much for your help! If I have an answer, I will notice you.
    – Tony Chen
    Jan 19, 2017 at 0:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .