Я новичок в Linux. Я установил ImageMagick в качестве инструкции по ответу, и он сработал. Но когда я запускаю свой код python, как показано ниже:
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")
, он все равно дает мне такую ошибку:
[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
говорит, что ImageMagick не установлен на моем компьютере (моя текущая версия ОС - Ubuntu 16.04 LTS, моя версия python - 2.7.12). Кто-нибудь мне помогает? Спасибо!
У вас может быть ImageMagic VIEWER, но вам, вероятно, не хватает библиотеки devel, которую ищет программа Python.
Вот список пакетов из моей системы. Вам, вероятно, потребуется несколько пакетов. Посмотрите на самый конец, для привязок Python. Я подозреваю, что если вы установите их, они принесут другие требования. Я не знаю, сколько еще файлов заголовков вам нужно, но если вы не закончите с libmagick ++ - dev, я буду удивлен.
$ 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
Вместо того, чтобы устанавливать вручную один за другим с помощью apt-get, я рекомендую новичкам установить программу «синаптика». Он предлагает гораздо лучшее представление о том, что есть и что вы можете получить.
Сейчас я смотрю синаптический, мне кажется, что есть несколько других пакетов imagicmagick & lt; -> python. Ищите «python-pythonmagic» или «python-wand». Мне кажется, есть много возможностей для изучения.
Вот отличный ответ. Я чувствую твою боль. Я не должен был так уверенно относиться к отсутствующим свойствам python devel, это обычная вещь для новых пользователей.
То же самое, что обсуждалось в этом потоке Reddit:
https: // www .reddit.com / r / moviepy / comments / 2q4754 / need_help_with_installationconfiguration /
Это о MS Windows
Страница кипы https://www.reddit.com/r / moviepy / comments / 2q4754 / need_help_with_installationconfiguration / имеет тот же совет для пользователей Windows, но говорит, что Linux должен работать из коробки. Я был уверен, думая: «Я могу сделать эту работу для моего нового друга ...»
Я установил видеоролик, чтобы посмотреть, что он делает. У меня не было вашего видео, я нашел небольшую вещь «toystory.mp4» для тестирования (поставьте копию в http://pj.freefaculty.org/scraps, если вы хотите попробовать). Этот код является примером на главной странице: 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)
Я получаю ту же ошибку:
>>> 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 Ошибка: создание None завершилось ошибкой из-за следующей ошибки:
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
Я подумал про себя: «Возможно, мне нужно исправить это, как пользователь Windows»,
from moviepy.config import change_settings
change_settings({"IMAGEMAGICK_BINARY": r"/usr/bin/convert"})
Это не так.
Итак, у меня нет ответа.
Но у меня есть новое предположение. Теперь я подозреваю, что версия ImageMagick, которую мы имеем, ведет себя таким образом, что кинематограф не ожидает. Это вызывает бесполезное сообщение об ошибке.
Правильное место, чтобы обратиться за помощью, находится в фильме. Пока у вас установлен конверт.
$ 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
У меня есть convert-im6, на который указывает / usr / bin / convert. Если эта версия слишком новая, это может вызвать проблемы, которые вы видите. Извините, это лучшее, что я могу сделать.
Если вы получите ответ, не забудьте сообщить нам ответ.