Solvedmoviepy 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 ?

17 Answers

✔️Accepted Answer

comment out (or remove the line that reads)
<policy domain="path" rights="none" pattern="@*" />

<!-- <policy domain="path" rights="none" pattern="@*" /> -->

Other Answers:

The following code allows me to work with text via MoviePy from a fresh Google Colab instance.

!apt update &> /dev/null
!apt install imagemagick &> /dev/null
!apt install ffmpeg &> /dev/null
!pip3 install moviepy[optional] &> /dev/null
!sed -i '/<policy domain="path" rights="none" pattern="@\*"/d' /etc/ImageMagick-6/policy.xml

Here sed is used to remove the line from the policy.xml file.

Check for the ImageMagick policy file. ImageMagick does not have the proper permission set:
/etc/ImageMagick-6/policy.xml

Related Issues:

36
moviepy ImageMagick not detected by moviepy while using SubtitlesClip
comment out (or remove the line that reads) <policy domain=path rights=none pattern=@* /> <!-- <poli...
21
moviepy Unable to run the sample code! Getting errors. Plase Help
I just figured this out. imagemagick (ie convert) has a policy.xml file that stops you from accessin...
12
moviepy AttributeError: module 'moviepy.audio.fx.all' has no attribute 'audio_fadein'
For everyone that has the same issue i solved it by modifying the selected init file shown in the pi...
521
ant motion 模版代码下载下来导入到dva搭建的项目里面,启动时报错(npm start)
开启 JavaScript 就可以了 你好,我下载的Home项目引入到项目工程里面,为了方便,我全部放到了components下面,引入和基本流程没有问题。在家里的win10上面启动没有报错,在win...
156
react native modal The statusbar turns white when the modal is open (only on certain devices)
statusBarTranslucent property has been added to Modal of RN 0.62 I think this problem has been solve...
138
lottie ios animation stop after enter background
Seem we have this to pause in background and restart when it reach foreground animationView.backgrou...
76
react native circular progress No component found for view with name "ARTSurfaceView"
I drag and dropped node_modules/react-native/Libraries/ART/ART.xcodeproj somewhere to my Xcode proje...
65
react native reanimated V2: Upgrade error InnerNativeModule.installCoreFunctions
was facing same problem react-native: 0.66.0 react-native-reanimated: ^2.3.0-beta.2 ...
61
uCrop FileUtils NumberFormatException
This is not a complete solution just nothing will happen But I think users should be able to open fi...
52
react native modal Error property 'left' is not supported by native animated module when using swipe
This is not due to react native limitations Keeping it as simple as the above ...
50
react native reanimated RN 0.61 Android build fails
I am still facing this This likely has to do with AndroidX or other things of which I am somewhat ig...
46
react native circular progress Invariant Violation: requireNative Component: "RNSVGPath" was not found in the UIManager
for any future person coming here with this issue that I faced on Android make sure to recompile you...
36
react native modal Tap outside to close
@Doko-Demo-Doa according to the source code haven't implemented yet there is no close event on backd...
29
react native modal How to avoid keyboard for bottom half modal
FWIW for those coming from Google Let's say we have a bottom half modal with some TextInput ...
29
react native reanimated TurboModuleRegistry NativeReanimated error
When loading with 2.0.0-alpha.8 I'm still running into ExceptionsManager.js:179 Invariant Violation:...
23
manim Failed to build pycairo in ubuntu
I got the same problem during the installation and these commands solved the problem. ...
20
react native modal How could we add swipe down to close function?
+1 for this feature please Hi I love the way this module: https://github.com/maxs15/react-native-mod...
20
react native reanimated [Jest] V2 - rc2 Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'NativeReanimated'
I opened a PR but if you guys want a temporary fix Use ds300/patch-package and put this on patches/r...
18
react native reanimated Unable to resolve module ./abs
@jakub-gonet I think in my case watchman was the culprit as even after --reset-cache the issue was s...
16
barba Update body class?
Got it working with events too: Is it possible to update the body class between transitions? ...
15
react native reanimated [RN 0.66] iOS build failure: 'boost/operators.hpp' file not found
Try react-native-reanimated: 2.3.0-beta.2 It has fix for search paths Description After updating to ...
13
react native modal error: bundling failed: Error: Unable to resolve module `./animations`
this command fixed my issue npm start -- --reset-cache I upgraded my react-native-modal from 7.0.2 t...
13
react native reanimated Android only -> E/ReactNativeJS: undefined is not an object (evaluating '_ReanimatedModule.default.configureProps')
Make sure that you've added new ReanimatedPackage(),in MainApplication.java under getPackages Import...
12
lottie android JSON Reader AssertionError when doInBackground (Android 7, 8)
We are having the same issues (Lottie 2.5.5) - only Android 8 So hope to find a fix soon ...
8
SkeletonView Wrong skeleton view width on iPhone 8 plus
Ok I've found my problem I was calling showSkeleton in viewDidLoad Moving it to viewDidAppear fixed ...
8
aseprite Skia build fails on Mojave
For me I have to use @adennen 's solution and also disable webp via skia_use_libwebp=false due to I ...
7
animated tab bar Major issue when using hidesBottomBarWhenPushed. Please investigate
@sentiasa Hi! It's very easy to solve this issue by using this: Hey guys ...
7
barba CF7 Wordpess reload
Hi The newest version of wpcf7 needs some code changes: Hi there ...
7
react native modal modal not begin from bottom
<Modal style={{ margin: 0 }}>....</Modal> can fix your problem I try to make modal that begin from b...
5
CompactCalendarView Show Event indicators to currently selected day
I've released a new beta version: Let me know if you have any feedback While Adding events to curren...
5
lottie ios Use image resources in lottie-ios
Hi guys I think the best solution is AnimationImageProvider Lottie has AnimationImageProvider I am s...
5
barba View afterEnter hook on browser refresh is not triggered
Fixed in @barba/core 2.3.15 Hi there! First of all thanks alot for the great work Using barba since ...
5
react three fiber Panning / Orbit Controls
@gino8080 you can also import OrbitalControl from drei I'm trying to implement a panning system on s...
5
svg.js svg rectangle with select resize and draggy
Oh cmon - you enable pointerevents on purpose for all elements with and then you wonder why the rect...
4
CompactCalendarView Remove First Day as SelectedDayBgColor
Added new xml property and method: Set that to false to not select first day of month Released anew ...
4
barba Uncaught (in promise) Error: xhr: HTTP code is not 200
I may have had some luck with this issue by passing a larger value to the XHR Timeout The default is...
3
SkeletonView SkeletonView not working in TableViewCell with custom class
@pennywise94 I ran into this issue too; the giant solid happens because calling showSkeleton() on a ...
3
FluidTransitions willBlur, didBlur listener not call
Experiencing this again with react-navigation@3.1.0 Perhaps an issue in react-navigation See this th...
3
react three fiber ✍️ Roadmap for 2.x (suggestions welcome)
@samburgers with the last commits that went in you can do this easily Just keep configs in state and...
90
glide on Android 10 (Q) , Glide failed to load image from Image from local storage
I have found workaround for above issue on below link fix for above issue add android:requestLegacyE...
71
glide Glide is incompatible with androidx.*
(with in gradle.properties) worked for me Glide Version: 4.7.1 Device/Android Version: All ...
63
peek convert fails due to resource limits
I think I've found the issue or at least a workaround Hi I'm on Debian with version below ...
36
ImageSharp WebP Support
I am working on support for webp So far decoding of lossless images is almost done I will continue w...
36
imagemin /node_modules/jpegtran-bin/vendor/jpegtran ENOENT
Try to rebuild the jpegtran-bin package npm rebuild jpegtran-bin What do I wrong? Node 5.6.0 NPM 3.7...
27
peek mouse/interaction with recording area on i3
So the way to do it is to make both peek and the window you're trying to capture into floating mode ...
24
glide The 4.4.0 version is conflict with appcompat-v7:26.1.0
What about just: You'll have to manually include the support-fragment dependency but otherwise it sh...
24
libvips Install via package managers on Linux?
Amazon Linux 2 seems to be based on RHEL/CentOS 7[1] so I assume you could use Remi's RPM repository...
22
glide Release Build Failed for Android Studio 3
As #2356 (thanks @SIARAY) shows the problem is Glide referencing android.graphics.Bitmap$Config.HARD...
20
glide Certain pictures not loading in Android 4.x
Hi guys From log it seems to be handshake exception Android 4.4 and lower don't support certain prot...
15
glide Failed to resolve variable '${project.groupId}' after refactoring to androidX
I get this error when migrating to androidx I do not use glide Adding implementation 'com.google.and...