Video editing with Python
Simpler custom configuration and better related docs (#1109)
Martín Gaitán9cc52c27031b
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 542b9d2c..7e789d12 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -12,9 +12,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Important Announcements- Support removed for Python versions 2.7, 3.4 & 3.5 [#1103, #1106]+- If you were previously setting custom locations for FFmpeg or ImageMagick in ``config_defaults.py`` and MoviePy still cannot autodetect the binaries, you will need to switch to the new method using enviroment variables. [#1109]### Added <!-- for new features -->- Support for path-like objects as an option wherever filenames are passed in as arguments+- Autodetect ImageMagick executable on Windows [#1109]+- Optionally configure paths to FFmpeg and ImageMagick binaries with environment variables or a ``.env`` file [#1109]- Optional `encoding` parameter in `SubtitlesClip` [#1043]### Changed <!-- for changes in existing functionality -->@@ -22,7 +25,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Deprecated <!-- for soon-to-be removed features -->### Removed <!-- for now removed features -->-- Support for Python versions 2.7, 3.4 & 3.5+- Support removed for Python versions 2.7, 3.4 & 3.5+- Setting paths to ImageMagick and FFMpeg binaries in ``config_defaults.py`` is no longer possible [#1109]+- Removed ``config.get_setting()`` and ``config.change_settings()`` functions [#1109]- All previously deprecated methods and parameters [#1115]:- `AudioClip.to_audiofile()` -> use `AudioClip.write_audiofile()`- `VideoClip.to_videofile()` -> use `VideoClip.write_videofile()`diff --git a/README.rst b/README.rstindex c39d9b0f..b281c514 100644--- a/README.rst+++ b/README.rst@@ -71,7 +71,7 @@ If you have neither ``setuptools`` nor ``ez_setup`` installed, the command above.. code:: bash- $ (sudo) pip install ez_setup+ $ (sudo) pip install setuptoolsOptional but useful dependencies@@ -85,11 +85,7 @@ You can install ``moviepy`` with all dependencies via:ImageMagick_ is not strictly required, but needed if you want to incorporate texts. It can also be used as a backend for GIFs, though you can also create GIFs with MoviePy without ImageMagick.-Once you have installed ImageMagick, it will be automatically detected by MoviePy, **except on Windows!** Windows users, before installing MoviePy by hand, need to edit ``moviepy/config_defaults.py`` to provide the path to the ImageMagick binary, which is called `convert`. It should look like this:--.. code:: python-- IMAGEMAGICK_BINARY = "C:\\Program Files\\ImageMagick_VERSION\\convert.exe"+Once you have installed ImageMagick, MoviePy will try to autodetect the path to its executable. If it fails, you can still configure it by setting environment variables (see the documentation).PyGame_ is needed for video and sound previews (not relevant if you intend to work with MoviePy on a server but essential for advanced video editing by hand).@@ -101,20 +97,6 @@ For advanced image processing, you will need one or several of the following pac- `OpenCV 2.4.6`_ or a more recent version (one that provides the package ``cv2``) may be needed for some advanced image manipulation.- `Matplotlib`_-Once you have installed it, ImageMagick will be automatically detected by MoviePy, (except for windows users and Ubuntu 16.04LTS users).--For Windows users, before installing MoviePy by hand, go into the ``moviepy/config_defaults.py`` file and provide the path to the ImageMagick binary called ``magick``. It should look like this:--.. code:: python-- IMAGEMAGICK_BINARY = "C:\\Program Files\\ImageMagick_VERSION\\magick.exe"--If you are using an older version of ImageMagick, keep in mind the name of the executable is not ``magick.exe`` but ``convert.exe``. In that case, the IMAGEMAGICK_BINARY property should be ``C:\\Program Files\\ImageMagick_VERSION\\convert.exe``--For Ubuntu 16.04LTS users, after installing MoviePy on the terminal, IMAGEMAGICK will not be detected by moviepy. This bug can be fixed. Modify the file in this directory: /etc/ImageMagick-6/policy.xml, comment out the statement <!-- <policy domain="path" rights="none" pattern="@*" /> -->.--PyGame_ is needed for video and sound previews (useless if you intend to work with MoviePy on a server but really essential for advanced video editing *by hand*).-For instance, using the method ``clip.resize`` requires that at least one of Scipy, PIL, Pillow or OpenCV is installed.@@ -239,4 +221,4 @@ Maintainers.. _`@mbeacom`: https://github.com/mbeacom.. _`@overdrivr`: https://github.com/overdrivr.. _`@keikoro`: https://github.com/keikoro-.. _`@ryanfox`: https://github.com/ryanfox+.. _`@ryanfox`: https://github.com/ryanfox\ No newline at end of filediff --git a/docs/install.rst b/docs/install.rstindex f5acd0f2..734094e9 100644--- a/docs/install.rst+++ b/docs/install.rst@@ -7,46 +7,111 @@ Download and InstallationInstallation---------------**Method with pip:** if you have ``pip`` installed, just type this in a terminal (it will install ez_setup if you don't already have it) ::+**Method with pip:** if you have ``pip`` installed, just type this in a terminal- (sudo) pip install moviepy+.. code:: bash-If you have neither ``setuptools`` nor ``ez_setup`` installed the command above will fail, is this case type this before installing: ::+ $ (sudo) pip install moviepy- (sudo) pip install ez_setup+If you have neither ``setuptools`` nor ``ez_setup`` installed the command above will fail. In this case type the following before installing:-**Method by hand:** download the sources, either on PyPI_ or (if you want the development version) on Github_, unzip everything in one folder, open a terminal and type ::+.. code:: bash- (sudo) python setup.py install+ $ (sudo) pip install setuptools-MoviePy depends on the Python modules NumPy_, Imageio_, Decorator_, and Proglog_, which will be automatically installed during MoviePy's installation. It should work on Windows/Mac/Linux, with Python 2.7+ and 3 ; if you have trouble installing MoviePy or one of its dependencies, please provide feedback!+**Method by hand:** Download the sources, either on PyPI_ or (if you want the development version) on Github_, unzip everything in one folder, open a terminal and type-MoviePy depends on the software FFMPEG for video reading and writing. You don't need to worry about that, as FFMPEG should be automatically downloaded/installed by ImageIO during your first use of MoviePy (it takes a few seconds). If you want to use a specific version of FFMPEG, you can set the FFMPEG_BINARY environment variable See ``moviepy/config_defaults.py`` for details.+.. code:: bash++ $ (sudo) python setup.py install++MoviePy depends on the Python modules NumPy_, Imageio_, Decorator_, and Proglog_, which will be automatically installed during MoviePy's installation. It should work on Windows/macOS/Linux, with Python 3.6+. If you have trouble installing MoviePy or one of its dependencies, please provide feedback in a Github issue!++MoviePy depends on the software FFMPEG for video reading and writing. You don't need to worry about that, as FFMPEG should be automatically downloaded/installed by ImageIO during your first use of MoviePy (it takes a few seconds). If you want to use a specific version of FFMPEG, you can set the+`FFMPEG_BINARY` environment variable.Other optional but useful dependencies~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-ImageMagick_ is not strictly required, only if you want to write texts. It can also be used as a backend for GIFs but you can do GIFs with MoviePy without ImageMagick.+You can install ``moviepy`` with all dependencies via:++.. code:: bash-Once you have installed it, ImageMagick will be automatically detected by MoviePy, **except on Windows!**. Windows user, before installing MoviePy by hand, go into the ``moviepy/config_defaults.py`` file and provide the path to the ImageMagick binary called `magick`. It should look like this ::+ $ (sudo) pip install moviepy[optional]- IMAGEMAGICK_BINARY = "C:\\Program Files\\ImageMagick_VERSION\\magick.exe"-You can also set the IMAGEMAGICK_BINARY environment variable See ``moviepy/config_defaults.py`` for details.+ImageMagick_ is not strictly required, but needed if you want to use TextClips_. It can also be used as a backend for GIFs, though you can also create GIFs with MoviePy without ImageMagick.-If you are using an older version of ImageMagick, keep in mind the name of the executable is not ``magick.exe`` but ``convert.exe``. In that case, the IMAGEMAGICK_BINARY property should be ``C:\\Program Files\\ImageMagick_VERSION\\convert.exe``+Once you have installed ImageMagick, MoviePy will try to autodetect the path to its executable. If it fails, you can still configure it by setting environment variables.-PyGame_ is needed for video and sound previews (useless if you intend to work with MoviePy on a server but really essential for advanced video editing *by hand*).+PyGame_ is needed for video and sound previews (useless you intend to work with MoviePy on a server but really essential for advanced video editing *by hand*).For advanced image processing you will need one or several of these packages. For instance using the method ``clip.resize`` requires that at least one of Scipy, PIL, Pillow or OpenCV are installed.- The Python Imaging Library (PIL) or, better, its branch Pillow_ .-- Scipy_ (for tracking, segmenting, etc.), and can be used for resizing video clips if PIL and OpenCV aren't installed on your computer.+- Scipy_ is needed for tracking, segmenting, etc., and can be used for resizing video clips if PIL and OpenCV aren't installed on your computer.- `Scikit Image`_ may be needed for some advanced image manipulation.-- `OpenCV 2.4.6`_ or more recent (provides the package ``cv2``) or more recent may be needed for some advanced image manipulation.+- `OpenCV`_ (provides the package ``cv2``) may be needed for some advanced image manipulation.++If you are on Linux, these packages will likely be in your repos.++For Ubuntu 16.04LTS users, after installing MoviePy on the terminal, ImageMagick may not be detected by MoviePy. This bug can be fixed. Modify the file ``/etc/ImageMagick-6/policy.xml`` commenting out the statement::++ <!-- <policy domain="path" rights="none" pattern="@*" /> -->+++Custom paths to external tools+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~++There are a couple of environment variables used by MoviePy that allow you+to configure custom paths to the external tools.++To setup any of these variables, the easiest way is to do it in Python before importing objects from MoviePy. For example:++.. code-block:: python++ import os+ os.environ["FFMPEG_BINARY"] = "/path/to/custom/ffmpeg"+++Alternatively, after installing the optional dependencies, you can create+a ``.env`` file in your working directory that will be automatically read.+For example++.. code-block:: ini++ FFMPEG_BINARY=/path/to/custom/ffmpeg+++There are 2 available environment variables:++``FFMPEG_BINARY``+ Normally you can leave it to its default ('ffmpeg-imageio') in which+ case imageio will download the right ffmpeg binary (on first use) and then always use that binary.++ The second option is ``"auto-detect"``. In this case ffmpeg will be whatever+ binary is found on the computer: generally ``ffmpeg`` (on Linux/macOS) or ``ffmpeg.exe`` (on Windows).++ Lastly, you can set it to use a binary at a specific location on your disk by specifying the exact path.+++``IMAGEMAGICK_BINARY``+ The default is ``"auto-detect"``.++ You can set it to use a binary at a specific location on your disk. On Windows, this might look like::++ os.environ["IMAGEMAGICK_BINARY"] = r"C:\Program Files\ImageMagick-6.8.8-Q16\magick.exe"++ Note: If you are using a legacy version of ImageMagick, the executable could be ``convert.exe`` instead.+++To test if FFmpeg and ImageMagick are found by MoviePy, in a Python console run:++.. code-block:: python-If you are on linux, these packages will likely be in your repos.+ >>> from moviepy.config import check+ >>> check().. _`Numpy`: https://www.scipy.org/install.html.. _decorator: https://pypi.python.org/pypi/decorator@@ -54,6 +119,7 @@ If you are on linux, these packages will likely be in your repos... _ffmpeg: https://www.ffmpeg.org/download.html+.. _TextClips: https://zulko.github.io/moviepy/ref/VideoClip/VideoClip.html#textclip.. _imageMagick: https://www.imagemagick.org/script/index.php.. _Pygame: https://www.pygame.org/download.shtml@@ -65,6 +131,6 @@ If you are on linux, these packages will likely be in your repos... _Github: https://github.com/Zulko/moviepy.. _PyPI: https://pypi.python.org/pypi/moviepy-.. _`OpenCV 2.4.6`: https://github.com/skvark/opencv-python+.. _`OpenCV`: https://github.com/skvark/opencv-pythondiff --git a/moviepy/audio/io/ffmpeg_audiowriter.py b/moviepy/audio/io/ffmpeg_audiowriter.pyindex 94d1a661..457194e5 100644--- a/moviepy/audio/io/ffmpeg_audiowriter.py+++ b/moviepy/audio/io/ffmpeg_audiowriter.py@@ -3,7 +3,7 @@ import subprocess as spimport proglog-from moviepy.config import get_setting+from moviepy.config import FFMPEG_BINARYfrom moviepy.decorators import requires_duration@@ -54,7 +54,7 @@ class FFMPEG_AudioWriter:cmd = ([- get_setting("FFMPEG_BINARY"),+ FFMPEG_BINARY,"-y","-loglevel","error" if logfile == sp.PIPE else "info",diff --git a/moviepy/audio/io/readers.py b/moviepy/audio/io/readers.pyindex 8ca6dab1..abefd4f2 100644--- a/moviepy/audio/io/readers.py+++ b/moviepy/audio/io/readers.py@@ -4,7 +4,7 @@ import warningsimport numpy as np-from moviepy.config import get_setting+from moviepy.config import FFMPEG_BINARYfrom moviepy.video.io.ffmpeg_reader import ffmpeg_parse_infos@@ -84,7 +84,7 @@ class FFMPEG_AudioReader:i_arg = ["-i", self.filename, "-vn"]cmd = (- [get_setting("FFMPEG_BINARY")]+ [FFMPEG_BINARY]+ i_arg+ ["-loglevel",diff --git a/moviepy/config.py b/moviepy/config.pyindex 98488d9c..5046edf4 100644--- a/moviepy/config.py+++ b/moviepy/config.py@@ -1,11 +1,22 @@import os+from pathlib import Pathimport subprocess as sp-from .config_defaults import FFMPEG_BINARY, IMAGEMAGICK_BINARYif os.name == "nt":import winreg as wr+try:+ from dotenv import load_dotenv, find_dotenv++ DOTENV = find_dotenv()+ load_dotenv(DOTENV)+except ImportError:+ DOTENV = None++FFMPEG_BINARY = os.getenv("FFMPEG_BINARY", "ffmpeg-imageio")+IMAGEMAGICK_BINARY = os.getenv("IMAGEMAGICK_BINARY", "auto-detect")+def try_cmd(cmd):try:@@ -41,14 +52,14 @@ else:success, err = try_cmd([FFMPEG_BINARY])if not success:raise IOError(- str(err) + " - The path specified for the ffmpeg binary might be wrong"+ f"{err} - The path specified for the ffmpeg binary might be wrong")if IMAGEMAGICK_BINARY == "auto-detect":if os.name == "nt":try:key = wr.OpenKey(wr.HKEY_LOCAL_MACHINE, "SOFTWARE\\ImageMagick\\Current")- IMAGEMAGICK_BINARY = wr.QueryValueEx(key, "BinPath")[0] + r"\convert.exe"+ IMAGEMAGICK_BINARY = wr.QueryValueEx(key, "BinPath")[0] + r"\magick.exe"key.Close()except Exception:IMAGEMAGICK_BINARY = "unset"@@ -58,53 +69,33 @@ if IMAGEMAGICK_BINARY == "auto-detect":IMAGEMAGICK_BINARY = "unset"else:if not os.path.exists(IMAGEMAGICK_BINARY):- raise IOError(- "ImageMagick binary cannot be found at {}".format(IMAGEMAGICK_BINARY)- )+ raise IOError(f"ImageMagick binary cannot be found at {IMAGEMAGICK_BINARY}")if not os.path.isfile(IMAGEMAGICK_BINARY):- raise IOError(- "ImageMagick binary found at {} is not a file".format(IMAGEMAGICK_BINARY)- )-+ raise IOError(f"ImageMagick binary found at {IMAGEMAGICK_BINARY} is not a file")success, err = try_cmd([IMAGEMAGICK_BINARY])if not success:raise IOError(- "%s - The path specified for the ImageMagick binary might "- "be wrong: %s" % (err, IMAGEMAGICK_BINARY)+ f"{err} - The path specified for the ImageMagick binary might "+ f"be wrong: {IMAGEMAGICK_BINARY}")-def get_setting(varname):- """ Returns the value of a configuration variable. """- gl = globals()- if varname not in gl.keys():- raise ValueError("Unknown setting %s" % varname)- # Here, possibly add some code to raise exceptions if some- # parameter isn't set set properly, explaining on how to set it.- return gl[varname]---def change_settings(new_settings=None, filename=None):- """ Changes the value of configuration variables."""- new_settings = new_settings or {}- gl = globals()- if filename:- with open(filename) as in_file:- exec(in_file)- gl.update(locals())- gl.update(new_settings)- # Here you can add some code to check that the new configuration- # values are valid.---if __name__ == "__main__":+def check():if try_cmd([FFMPEG_BINARY])[0]:- print("MoviePy : ffmpeg successfully found.")+ print(f"MoviePy: ffmpeg successfully found in '{FFMPEG_BINARY}'.")else:- print("MoviePy : can't find or access ffmpeg.")+ print(f"MoviePy: can't find or access ffmpeg in '{FFMPEG_BINARY}'.")if try_cmd([IMAGEMAGICK_BINARY])[0]:- print("MoviePy : ImageMagick successfully found.")+ print(f"MoviePy: ImageMagick successfully found in '{IMAGEMAGICK_BINARY}'.")else:- print("MoviePy : can't find or access ImageMagick.")+ print(f"MoviePy: can't find or access ImageMagick in '{IMAGEMAGICK_BINARY}'.")++ if DOTENV:+ print(f"\n.env file content at {DOTENV}:\n")+ print(Path(DOTENV).read_text())+++if __name__ == "__main__":+ check()diff --git a/moviepy/config_defaults.py b/moviepy/config_defaults.pydeleted file mode 100644index 248f710c..00000000--- a/moviepy/config_defaults.py+++ /dev/null@@ -1,54 +0,0 @@-r"""-Configuration of MoviePy---This file enables you to specify a configuration for MoviePy. In-particular you can enter the path to the FFMPEG and ImageMagick-binaries.--Defaults must be done BEFORE installing MoviePy: first make the changes,-then install MoviePy with-- [sudo] python setup.py install--Note that you can also change the path by setting environment variables.-e.g.--Linux/Mac:- export FFMPEG_BINARY=path/to/ffmpeg--Windows:- set FFMPEG_BINARY=path\to\ffmpeg--Instructions-----------------FFMPEG_BINARY- Normally you can leave this one to its default ('ffmpeg-imageio') at which- case image-io will download the right ffmpeg binary (at first use) and then- always use that binary.- The second option is 'auto-detect', in this case ffmpeg will be whatever- binary is found on the computer generally 'ffmpeg' (on linux) or 'ffmpeg.exe'- (on windows).- Third option: If you want to use a binary at a special location on you disk,- enter it like that:-- FFMPEG_BINARY = r"path/to/ffmpeg" # on linux- FFMPEG_BINARY = r"path\to\ffmpeg.exe" # on windows-- Warning: the 'r' before the path is important, especially on Windows.---IMAGEMAGICK_BINARY- For linux users, 'convert' should be fine.- For Windows users, you must specify the path to the ImageMagick- 'magick' binary. For instance:-- IMAGEMAGICK_BINARY = r"C:\Program Files\ImageMagick-6.8.8-Q16\magick.exe"--"""--import os--FFMPEG_BINARY = os.getenv("FFMPEG_BINARY", "ffmpeg-imageio")-IMAGEMAGICK_BINARY = os.getenv("IMAGEMAGICK_BINARY", "auto-detect")diff --git a/moviepy/video/VideoClip.py b/moviepy/video/VideoClip.pyindex 2355030e..f9615b79 100644--- a/moviepy/video/VideoClip.py+++ b/moviepy/video/VideoClip.py@@ -13,7 +13,7 @@ import proglogfrom imageio import imread, imsavefrom moviepy.Clip import Clip-from moviepy.config import get_setting+from moviepy.config import IMAGEMAGICK_BINARYfrom moviepy.decorators import (add_mask_if_none,apply_to_mask,@@ -1170,7 +1170,7 @@ class TextClip(ImageClip):)cmd = [- get_setting("IMAGEMAGICK_BINARY"),+ IMAGEMAGICK_BINARY,"-background",bg_color,"-fill",@@ -1209,15 +1209,13 @@ class TextClip(ImageClip):try:subprocess_call(cmd, logger=None)except (IOError, OSError) as err:- error = "MoviePy Error: creation of %s failed because of the " "following error:\n\n%s.\n\n." % (- filename,- str(err),- ) + (+ error = (+ f"MoviePy Error: creation of {filename} failed because of the "+ f"following error:\n\n{err}.\n\n.""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 binary. Check the documentation.")raise IOError(error)@@ -1243,9 +1241,7 @@ class TextClip(ImageClip):popen_params["creationflags"] = 0x08000000process = sp.Popen(- [get_setting("IMAGEMAGICK_BINARY"), "-list", arg],- encoding="utf-8",- **popen_params,+ [IMAGEMAGICK_BINARY, "-list", arg], encoding="utf-8", **popen_params)result = process.communicate()[0]lines = result.splitlines()diff --git a/moviepy/video/io/ffmpeg_reader.py b/moviepy/video/io/ffmpeg_reader.pyindex d4aa2a2e..bb3b46f2 100644--- a/moviepy/video/io/ffmpeg_reader.py+++ b/moviepy/video/io/ffmpeg_reader.py@@ -13,7 +13,7 @@ import warningsimport numpy as np-from moviepy.config import get_setting # ffmpeg, ffmpeg.exe, etc...+from moviepy.config import FFMPEG_BINARY # ffmpeg, ffmpeg.exe, etc...from moviepy.tools import cvsecslogging.captureWarnings(True)@@ -91,7 +91,7 @@ class FFMPEG_VideoReader:i_arg = ["-i", self.filename]cmd = (- [get_setting("FFMPEG_BINARY")]+ [FFMPEG_BINARY]+ i_arg+ ["-loglevel",@@ -262,7 +262,7 @@ def ffmpeg_parse_infos(# open the file in a pipe, provoke an error, read outputis_GIF = filename.endswith(".gif")- cmd = [get_setting("FFMPEG_BINARY"), "-i", filename]+ cmd = [FFMPEG_BINARY, "-i", filename]if is_GIF:cmd += ["-f", "null", "/dev/null"]diff --git a/moviepy/video/io/ffmpeg_tools.py b/moviepy/video/io/ffmpeg_tools.pyindex b5b78866..477d0f77 100644--- a/moviepy/video/io/ffmpeg_tools.py+++ b/moviepy/video/io/ffmpeg_tools.py@@ -2,7 +2,7 @@import os-from moviepy.config import get_setting+from moviepy.config import FFMPEG_BINARYfrom moviepy.decorators import convert_path_to_stringfrom moviepy.tools import subprocess_call@@ -15,7 +15,7 @@ def ffmpeg_movie_from_frames(filename, folder, fps, digits=6, bitrate="v"):"""s = "%" + "%02d" % digits + "d.png"cmd = [- get_setting("FFMPEG_BINARY"),+ FFMPEG_BINARY,"-y","-f","image2",@@ -43,7 +43,7 @@ def ffmpeg_extract_subclip(filename, t1, t2, targetname=None):targetname = "%sSUB%d_%d.%s" % (name, T1, T2, ext)cmd = [- get_setting("FFMPEG_BINARY"),+ FFMPEG_BINARY,"-y","-ss","%0.2f" % t1,@@ -76,7 +76,7 @@ def ffmpeg_merge_video_audio(""" merges video file ``video`` and audio file ``audio`` into onemovie file ``output``. """cmd = [- get_setting("FFMPEG_BINARY"),+ FFMPEG_BINARY,"-y","-i",audio,@@ -96,7 +96,7 @@ def ffmpeg_merge_video_audio(def ffmpeg_extract_audio(inputfile, output, bitrate=3000, fps=44100):""" extract the sound from a video file and save it in ``output`` """cmd = [- get_setting("FFMPEG_BINARY"),+ FFMPEG_BINARY,"-y","-i",inputfile,@@ -114,7 +114,7 @@ def ffmpeg_resize(video, output, size):""" resizes ``video`` to new size ``size`` and write the resultin file ``output``. """cmd = [- get_setting("FFMPEG_BINARY"),+ FFMPEG_BINARY,"-i",video,"-vf",diff --git a/moviepy/video/io/ffmpeg_writer.py b/moviepy/video/io/ffmpeg_writer.pyindex 0ef4c5b7..0ce4264b 100644--- a/moviepy/video/io/ffmpeg_writer.py+++ b/moviepy/video/io/ffmpeg_writer.py@@ -9,7 +9,7 @@ import subprocess as spimport numpy as npfrom proglog import proglog-from moviepy.config import get_setting+from moviepy.config import FFMPEG_BINARYclass FFMPEG_VideoWriter:@@ -88,7 +88,7 @@ class FFMPEG_VideoWriter:# order is importantcmd = [- get_setting("FFMPEG_BINARY"),+ FFMPEG_BINARY,"-y","-loglevel","error" if logfile == sp.PIPE else "info",@@ -268,7 +268,7 @@ def ffmpeg_write_image(filename, image, logfile=False):image = image.astype("uint8")cmd = [- get_setting("FFMPEG_BINARY"),+ FFMPEG_BINARY,"-y","-s","%dx%d" % (image.shape[:2][::-1]),diff --git a/moviepy/video/io/gif_writers.py b/moviepy/video/io/gif_writers.pyindex 89fc767f..dce984e8 100644--- a/moviepy/video/io/gif_writers.py+++ b/moviepy/video/io/gif_writers.py@@ -4,7 +4,7 @@ import subprocess as spimport numpy as npimport proglog-from moviepy.config import get_setting+from moviepy.config import FFMPEG_BINARY, IMAGEMAGICK_BINARYfrom moviepy.decorators import requires_duration, use_clip_fps_by_defaultfrom moviepy.tools import subprocess_call@@ -60,7 +60,7 @@ def write_gif_with_tempfiles(logger(message="MoviePy - - Optimizing GIF with ImageMagick...")cmd = ([- get_setting("IMAGEMAGICK_BINARY"),+ IMAGEMAGICK_BINARY,"-delay","%d" % delay,"-dispose",@@ -81,7 +81,7 @@ def write_gif_with_tempfiles(elif program == "ffmpeg":cmd = [- get_setting("FFMPEG_BINARY"),+ FFMPEG_BINARY,"-y","-f","image2",@@ -106,11 +106,11 @@ def write_gif_with_tempfiles()if program == "ImageMagick":- error = error + (+ error += ("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 config_defaults.py."+ "path to the ImageMagick binary. Check the documentation.")raise IOError(error)@@ -197,7 +197,7 @@ def write_gif(withmask = Falsecmd1 = [- get_setting("FFMPEG_BINARY"),+ FFMPEG_BINARY,"-y","-loglevel","error",@@ -247,7 +247,7 @@ def write_gif(if program == "ImageMagick":cmd2 = [- get_setting("IMAGEMAGICK_BINARY"),+ IMAGEMAGICK_BINARY,"-delay","%.02f" % (delay),"-dispose",@@ -271,14 +271,7 @@ def write_gif(if opt:cmd3 = (- [- get_setting("IMAGEMAGICK_BINARY"),- "-",- "-fuzz",- "%d" % fuzz + "%",- "-layers",- opt,- ]+ [IMAGEMAGICK_BINARY, "-", "-fuzz", "%d" % fuzz + "%", "-layers", opt,]+ (["-colors", "%d" % colors] if colors is not None else [])+ [filename])@@ -307,11 +300,11 @@ def write_gif()if program == "ImageMagick":- error = error + (+ error += ("This 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 config_defaults.py."+ "path to the ImageMagick binary. Check the documentation.")raise IOError(error)diff --git a/setup.py b/setup.pyindex 2dd347d1..fa33a008 100644--- a/setup.py+++ b/setup.py@@ -17,7 +17,7 @@ except ImportError:raise ImportError("MoviePy could not be installed, probably because"" neither setuptools nor ez_setup are installed on this computer."- "\nInstall ez_setup ([sudo] pip install ez_setup) and try again."+ "\nInstall setuptools ([sudo] pip install setuptools) and try again.")@@ -58,8 +58,7 @@ if "build_docs" in sys.argv:from sphinx.setup_command import BuildDocexcept ImportError:raise ImportError(- "Running the documentation builds has additional"- " dependencies. Please run (pip install moviepy[doc])"+ "Running the documenation builds has additional dependencies. Please run (pip install moviepy[doc])")cmdclass["build_docs"] = BuildDoc@@ -78,6 +77,7 @@ requires = []optional_reqs = [+ "python-dotenv>=0.10.0","opencv-python>=3.0,<4.0","scikit-image>=0.13.0,<1.0","scikit-learn",