Video editing with Python
Added to conf: IMAGEMAGICK_BINARY
Zulko222ffd2d43af
diff --git a/moviepy/conf.py b/moviepy/conf.pyindex 96aa110b..13da1d47 100644--- a/moviepy/conf.py+++ b/moviepy/conf.py@@ -1,23 +1,38 @@"""-Name (and location if needed) of the FFMPEG binary. It will be-"ffmpeg" on linux, certainly "ffmpeg.exe" on windows, else any path.-If not provided (None), the system will look for the right version-automatically each time you launch moviepy.-If you run this script file it will check that the-path to the ffmpeg binary (FFMPEG_BINARY)+Instructions+--------------++This file enables you to specify a configuration for MoviePy. In+particular you can enter the path to the FFMPEG and ImageMagick+binaries.++FFMPEG_BINARY+ Normally you can leave this one to its default (None) and MoviePy+ will detect automatically the right name, which will be either+ 'ffmpeg' (on linux) or 'ffmpeg.exe' (on windows)++IMAGEMAGICK_BINARY+ For linux users, 'convert' should be fine.+ For Windows users, you must specify the path to the ImageMagick+ 'convert' binary. For instance:+ "C:\Program Files\ImageMagick-6.8.8-Q16\convert"++You can run this file to check that FFMPEG has been detected."""FFMPEG_BINARY = None+IMAGEMAGICK_BINARY = 'convert'-# --------------------------------------------------------------------+# =====================================================================+# CODE. Don't write anything below this line :Oimport subprocess as sp-def tryffmpeg(FFMPEG_BINARY):+def try_cmd(cmd):try:- proc = sp.Popen([FFMPEG_BINARY],+ proc = sp.Popen(cmd,stdout=sp.PIPE,stderr=sp.PIPE)proc.communicate()@@ -29,18 +44,17 @@ def tryffmpeg(FFMPEG_BINARY):if FFMPEG_BINARY is None:- if tryffmpeg('ffmpeg'):+ if try_cmd(['ffmpeg']):FFMPEG_BINARY = 'ffmpeg'- elif tryffmpeg('ffmpeg.exe'):+ elif try_cmd(['ffmpeg.exe']):FFMPEG_BINARY = 'ffmpeg.exe'else:raise IOError("FFMPEG binary not found. Try installing MoviePy"\" manually and specify the path to the binary in"\" the file conf.py")-if __name__ == "__main__":- if tryffmpeg(FFMPEG_BINARY):+ if try_cmd([FFMPEG_BINARY]):print( "MoviePy : ffmpeg successfully found." )else:print( "MoviePy : can't find ffmpeg." )diff --git a/moviepy/version.py b/moviepy/version.pyindex 447246f5..cd480d78 100644--- a/moviepy/version.py+++ b/moviepy/version.py@@ -1 +1 @@-__version__ = '0.2.1.7.09'+__version__ = '0.2.1.7.11'diff --git a/moviepy/video/VideoClip.py b/moviepy/video/VideoClip.pyindex 4b6dd710..f1db65df 100644--- a/moviepy/video/VideoClip.py+++ b/moviepy/video/VideoClip.py@@ -28,7 +28,7 @@ from .io.ffmpeg_tools import ffmpeg_merge_video_audiofrom .tools.drawing import blitfrom ..Clip import Clip-from ..conf import FFMPEG_BINARY+from ..conf import FFMPEG_BINARY, IMAGEMAGICK_BINARYclass VideoClip(Clip):@@ -398,7 +398,7 @@ class VideoClip(Clip):if program == "ImageMagick":- cmd = ["convert",+ cmd = [IMAGEMAGICK_BINARY,'-delay' , '%d'%delay,"-dispose" ,"%d"%(2 if dispose else 1),"-loop" , "%d"%loop,@@ -926,7 +926,7 @@ class TextClip(ImageClip):size = ('' if size[0] is None else str(size[0]),'' if size[1] is None else str(size[1]))- cmd = ( ["convert",+ cmd = ( [IMAGEMAGICK_BINARY,"-background", bg_color,"-fill", color,"-font", font])@@ -972,7 +972,7 @@ class TextClip(ImageClip):Returns the list of all valid entries for the argument given(can be ``font``, ``color``, etc...) argument of ``TextClip``"""- process = subprocess.Popen(['convert', '-list', arg],+ process = subprocess.Popen([IMAGEMAGICK_BINARY, '-list', arg],stdout=subprocess.PIPE)result = process.communicate()[0]lines = result.splitlines()