0

I am trying to add simple text to a mp4 file. I have the mp4 file and I am using moviepy to add the text clip, however, I am continually running into errors.

My code:

import moviepy.editor as mpy

video_name='Test.mp4'

video = mpy.VideoFileClip('test_movie.mp4')
text = mpy.TextClip("Test", font="Arial", fontsize=40, color='white')
text = text.set_position('upper left').set_duration(video.duration)

test = mpy.CompositeVideoClip([video, text])
test.write_videofile('{}.mp4'.format(video_name))

And here is the error:

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

convert: delegate library support not built-in '/Library/Fonts//Arial.ttf' (Freetype) @ warning/annotate.c/RenderFreetype/1847.
convert: no decode delegate for this image format `PNG' @ error/constitute.c/ReadImage/512.
convert: no images defined `PNG32:/var/folders/l3/m81nh88n57s9ck30_fqd09cmcfj06p/T/tmp06GxjE.png' @ error/convert.c/ConvertImageCommand/3275.
.

.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 is installed on my system and I have been through a few threads on here but nothing has pointed me in the right direction. My font library is not empty and I do not know what it is having this issue. Any help would be greatly appreciated. I am on a Mac and using Spyder for a GUI.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
cpe28
  • 1
  • 1
  • Imagemagick needs freetype and possible fontconf delegates installed to deal with text fonts. Do you have those? You can see from `convert -version` and look at the line starting with Delegates. You may also need a the libpng delegate, which would show as PNG in the list. Also you would need to have installed ffmpeg for the mp4 file to be read. It won't show in the list of delegates. What are all the listed delegates? See also https://www.imagemagick.org/script/formats.php – fmw42 Aug 08 '18 at 20:13
  • This is the output from convert -version: LAPTOP-MSVOADTF:~$ convert -version The program 'convert' can be found in the following packages: * imagemagick * graphicsmagick-imagemagick-compat Try: sudo apt install So I did sudo apt install imagemagick, and then I got: E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? But I have ImageMagick installed – cpe28 Aug 09 '18 at 18:12
  • If you have Imagemagick installed is it version 7 or 6? If it is installed, then doing `convert -version` for IM 6 or `magick -version` for IM 7, should now tell you more about the delegates installed. Sorry I do not know Python. – fmw42 Aug 09 '18 at 20:13
  • That's ok. It's IM7, but doing convert -version still doesn't show anything. – cpe28 Aug 09 '18 at 22:26
  • With IM 7, you may need to use `magick -version` or `path/to/magick -version`. But if that shows nothing, then you must not have Imagemagick installed properly. – fmw42 Aug 09 '18 at 23:49

1 Answers1

0

Try to install ImageMagick from their website. If the problem still there, find the moviepy/config_defaults.py and after the last line add:

IMAGEMAGICK_BINARY = "C:\\Program Files\\ImageMagick_VERSION\\convert.exe
Auax
  • 346
  • 2
  • 11