1
0
mirror of https://github.com/Zulko/moviepy.git synced 2021-07-27 01:17:47 +03:00

Windows-based testing (#931)

* Introduce Pipfile to handle dependencies for dev envs

* Simplify appveyor script using pipenv

* Remove sudo

* Add user flag when upgrading pip

* Fix ImageMagick download

* Fix ImageMagick download again

* Fix setting env vars

* Fix missing module pathlib2

* Fix dir command

* Add missing dev dependency

* Fix ImageMagick paths

* Fix dir command

* Fix dir command

* Try to fix imagemagick install dir

* Investigate image magick path not found

* Investigate

* Try to fix IMAGEMAGICK binary loading

* INvestigate without spaces

* Fix typo

* Disable a few tests to fix Invalid Handle error when opening subprocesses

* Replace commented tests with pytest.skip + enforce appveyor base image

* Make builds more reproducible - avoid relying on external test data

* Drop support for python 3.4 and add python 3.7

* Fix travis build

* Cleanup debug code

* Clean appveyor file

* Minor cleanup

* Test on python 3.7

* Added contributor

* Update .travis.yml
This commit is contained in:
Rémi Bèges
2019-04-01 10:42:47 +02:00
committed by GitHub
parent 41d8fe0e61
commit 282848aae9
39 changed files with 399 additions and 276 deletions

1
.gitignore vendored
View File

@@ -56,7 +56,6 @@ nosetests.xml
# Tests
tests/media
media/
# Documentation
docs/build/

View File

@@ -11,7 +11,6 @@ before_install:
- sudo add-apt-repository -y ppa:kirillshkrogalev/ffmpeg-next
- sudo apt-get -y -qq update
- sudo apt-get install -y -qq ffmpeg
- mkdir media
# Ensure PIP is up-to-date to avoid warnings.
- python -m pip install --upgrade pip
@@ -19,7 +18,7 @@ before_install:
- pip install --upgrade setuptools
# The default py that is installed is too old on some platforms, leading to version conflicts
- pip install --upgrade py pytest
# modify ImageMagick policy file so that Textclips work correctly.
# `| sudo tee` replaces `>` so that it can have root permissions
- cat /etc/ImageMagick/policy.xml | sed 's/none/read,write/g' | sudo tee /etc/ImageMagick/policy.xml

14
Pipfile Normal file
View File

@@ -0,0 +1,14 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
moviepy = {editable = true, path = "."}
[dev-packages]
pytest = "*"
"pathlib2" = "*"
scandir = "*"
[requires]

243
Pipfile.lock generated Normal file
View File

@@ -0,0 +1,243 @@
{
"_meta": {
"hash": {
"sha256": "0c9805a9f43b881b56d92beec72aca2653fd84d4a0fb5f74c0097e23e5d852e9"
},
"pipfile-spec": 6,
"requires": {},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"certifi": {
"hashes": [
"sha256:59b7658e26ca9c7339e00f8f4636cdfe59d34fa37b9b04f6f9e9926b3cece1a5",
"sha256:b26104d6835d1f5e49452a26eb2ff87fe7090b89dfcaee5ea2212697e1e1d7ae"
],
"version": "==2019.3.9"
},
"chardet": {
"hashes": [
"sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae",
"sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"
],
"version": "==3.0.4"
},
"decorator": {
"hashes": [
"sha256:86156361c50488b84a3f148056ea716ca587df2f0de1d34750d35c21312725de",
"sha256:f069f3a01830ca754ba5258fde2278454a0b5b79e0d7f5c13b3b97e57d4acff6"
],
"version": "==4.4.0"
},
"idna": {
"hashes": [
"sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407",
"sha256:ea8b7f6188e6fa117537c3df7da9fc686d485087abf6ac197f9c46432f7e4a3c"
],
"version": "==2.8"
},
"imageio": {
"hashes": [
"sha256:1a2bbbb7cd38161340fa3b14d806dfbf914abf3ee6fd4592af2afb87d049f209",
"sha256:42e65aadfc3d57a1043615c92bdf6319b67589e49a0aae2b985b82144aceacad"
],
"version": "==2.5.0"
},
"imageio-ffmpeg": {
"hashes": [
"sha256:14efef5c82fdc3d314d56cbb4a9302e478afd9e1bdc3da7a1f0a67f42a5e3ec8",
"sha256:2beacb11b121440cfd0bc0caf80da54a3729956002707251ab8e26d3e03933a4",
"sha256:646cc63da4b6a955de5e30fbc63edb7c5692ac94fc100f4c71a7c122506122c6",
"sha256:d0eda59e2243375ca442e9428b299892425faf73e2e5f173d79de4362661dc50",
"sha256:dd3d4380d6e413819fef9f64f184cdc7e59cba88094383727bcf7ea5bb1bed99"
],
"version": "==0.2.0"
},
"moviepy": {
"editable": true,
"path": "."
},
"numpy": {
"hashes": [
"sha256:1980f8d84548d74921685f68096911585fee393975f53797614b34d4f409b6da",
"sha256:22752cd809272671b273bb86df0f505f505a12368a3a5fc0aa811c7ece4dfd5c",
"sha256:23cc40313036cffd5d1873ef3ce2e949bdee0646c5d6f375bf7ee4f368db2511",
"sha256:2b0b118ff547fecabc247a2668f48f48b3b1f7d63676ebc5be7352a5fd9e85a5",
"sha256:3a0bd1edf64f6a911427b608a894111f9fcdb25284f724016f34a84c9a3a6ea9",
"sha256:3f25f6c7b0d000017e5ac55977a3999b0b1a74491eacb3c1aa716f0e01f6dcd1",
"sha256:4061c79ac2230594a7419151028e808239450e676c39e58302ad296232e3c2e8",
"sha256:560ceaa24f971ab37dede7ba030fc5d8fa173305d94365f814d9523ffd5d5916",
"sha256:62be044cd58da2a947b7e7b2252a10b42920df9520fc3d39f5c4c70d5460b8ba",
"sha256:6c692e3879dde0b67a9dc78f9bfb6f61c666b4562fd8619632d7043fb5b691b0",
"sha256:6f65e37b5a331df950ef6ff03bd4136b3c0bbcf44d4b8e99135d68a537711b5a",
"sha256:7a78cc4ddb253a55971115f8320a7ce28fd23a065fc33166d601f51760eecfa9",
"sha256:80a41edf64a3626e729a62df7dd278474fc1726836552b67a8c6396fd7e86760",
"sha256:893f4d75255f25a7b8516feb5766c6b63c54780323b9bd4bc51cdd7efc943c73",
"sha256:972ea92f9c1b54cc1c1a3d8508e326c0114aaf0f34996772a30f3f52b73b942f",
"sha256:9f1d4865436f794accdabadc57a8395bd3faa755449b4f65b88b7df65ae05f89",
"sha256:9f4cd7832b35e736b739be03b55875706c8c3e5fe334a06210f1a61e5c2c8ca5",
"sha256:adab43bf657488300d3aeeb8030d7f024fcc86e3a9b8848741ea2ea903e56610",
"sha256:bd2834d496ba9b1bdda3a6cf3de4dc0d4a0e7be306335940402ec95132ad063d",
"sha256:d20c0360940f30003a23c0adae2fe50a0a04f3e48dc05c298493b51fd6280197",
"sha256:d3b3ed87061d2314ff3659bb73896e622252da52558f2380f12c421fbdee3d89",
"sha256:dc235bf29a406dfda5790d01b998a1c01d7d37f449128c0b1b7d1c89a84fae8b",
"sha256:fb3c83554f39f48f3fa3123b9c24aecf681b1c289f9334f8215c1d3c8e2f6e5b"
],
"version": "==1.16.2"
},
"pillow": {
"hashes": [
"sha256:051de330a06c99d6f84bcf582960487835bcae3fc99365185dc2d4f65a390c0e",
"sha256:0ae5289948c5e0a16574750021bd8be921c27d4e3527800dc9c2c1d2abc81bf7",
"sha256:0b1efce03619cdbf8bcc61cfae81fcda59249a469f31c6735ea59badd4a6f58a",
"sha256:163136e09bd1d6c6c6026b0a662976e86c58b932b964f255ff384ecc8c3cefa3",
"sha256:18e912a6ccddf28defa196bd2021fe33600cbe5da1aa2f2e2c6df15f720b73d1",
"sha256:24ec3dea52339a610d34401d2d53d0fb3c7fd08e34b20c95d2ad3973193591f1",
"sha256:267f8e4c0a1d7e36e97c6a604f5b03ef58e2b81c1becb4fccecddcb37e063cc7",
"sha256:3273a28734175feebbe4d0a4cde04d4ed20f620b9b506d26f44379d3c72304e1",
"sha256:4c678e23006798fc8b6f4cef2eaad267d53ff4c1779bd1af8725cc11b72a63f3",
"sha256:4d4bc2e6bb6861103ea4655d6b6f67af8e5336e7216e20fff3e18ffa95d7a055",
"sha256:505738076350a337c1740a31646e1de09a164c62c07db3b996abdc0f9d2e50cf",
"sha256:5233664eadfa342c639b9b9977190d64ad7aca4edc51a966394d7e08e7f38a9f",
"sha256:5d95cb9f6cced2628f3e4de7e795e98b2659dfcc7176ab4a01a8b48c2c2f488f",
"sha256:7eda4c737637af74bac4b23aa82ea6fbb19002552be85f0b89bc27e3a762d239",
"sha256:801ddaa69659b36abf4694fed5aa9f61d1ecf2daaa6c92541bbbbb775d97b9fe",
"sha256:825aa6d222ce2c2b90d34a0ea31914e141a85edefc07e17342f1d2fdf121c07c",
"sha256:9c215442ff8249d41ff58700e91ef61d74f47dfd431a50253e1a1ca9436b0697",
"sha256:a3d90022f2202bbb14da991f26ca7a30b7e4c62bf0f8bf9825603b22d7e87494",
"sha256:a631fd36a9823638fe700d9225f9698fb59d049c942d322d4c09544dc2115356",
"sha256:a6523a23a205be0fe664b6b8747a5c86d55da960d9586db039eec9f5c269c0e6",
"sha256:a756ecf9f4b9b3ed49a680a649af45a8767ad038de39e6c030919c2f443eb000",
"sha256:b117287a5bdc81f1bac891187275ec7e829e961b8032c9e5ff38b70fd036c78f",
"sha256:ba04f57d1715ca5ff74bb7f8a818bf929a204b3b3c2c2826d1e1cc3b1c13398c",
"sha256:cd878195166723f30865e05d87cbaf9421614501a4bd48792c5ed28f90fd36ca",
"sha256:cee815cc62d136e96cf76771b9d3eb58e0777ec18ea50de5cfcede8a7c429aa8",
"sha256:d1722b7aa4b40cf93ac3c80d3edd48bf93b9208241d166a14ad8e7a20ee1d4f3",
"sha256:d7c1c06246b05529f9984435fc4fa5a545ea26606e7f450bdbe00c153f5aeaad",
"sha256:e9c8066249c040efdda84793a2a669076f92a301ceabe69202446abb4c5c5ef9",
"sha256:f227d7e574d050ff3996049e086e1f18c7bd2d067ef24131e50a1d3fe5831fbc",
"sha256:fc9a12aad714af36cf3ad0275a96a733526571e52710319855628f476dcb144e"
],
"version": "==5.4.1"
},
"proglog": {
"hashes": [
"sha256:d8c4ccbf2138e0c5e3f3fc0d80dc51d7e69dcfe8bfde4cacb566725092a5b18d"
],
"version": "==0.1.9"
},
"requests": {
"hashes": [
"sha256:502a824f31acdacb3a35b6690b5fbf0bc41d63a24a45c4004352b0242707598e",
"sha256:7bf2a778576d825600030a110f3c0e3e8edc51dfaafe1c146e39a2027784957b"
],
"version": "==2.21.0"
},
"tqdm": {
"hashes": [
"sha256:d385c95361699e5cf7622485d9b9eae2d4864b21cd5a2374a9c381ffed701021",
"sha256:e22977e3ebe961f72362f6ddfb9197cc531c9737aaf5f607ef09740c849ecd05"
],
"version": "==4.31.1"
},
"urllib3": {
"hashes": [
"sha256:61bf29cada3fc2fbefad4fdf059ea4bd1b4a86d2b6d15e1c7c0b582b9752fe39",
"sha256:de9529817c93f27c8ccbfead6985011db27bd0ddfcdb2d86f3f663385c6a9c22"
],
"version": "==1.24.1"
}
},
"develop": {
"atomicwrites": {
"hashes": [
"sha256:03472c30eb2c5d1ba9227e4c2ca66ab8287fbfbbda3888aa93dc2e28fc6811b4",
"sha256:75a9445bac02d8d058d5e1fe689654ba5a6556a1dfd8ce6ec55a0ed79866cfa6"
],
"version": "==1.3.0"
},
"attrs": {
"hashes": [
"sha256:69c0dbf2ed392de1cb5ec704444b08a5ef81680a61cb899dc08127123af36a79",
"sha256:f0b870f674851ecbfbbbd364d6b5cbdff9dcedbc7f3f5e18a6891057f21fe399"
],
"version": "==19.1.0"
},
"colorama": {
"hashes": [
"sha256:05eed71e2e327246ad6b38c540c4a3117230b19679b875190486ddd2d721422d",
"sha256:f8ac84de7840f5b9c4e3347b3c1eaa50f7e49c2b07596221daec5edaabbd7c48"
],
"markers": "sys_platform == 'win32'",
"version": "==0.4.1"
},
"more-itertools": {
"hashes": [
"sha256:0125e8f60e9e031347105eb1682cef932f5e97d7b9a1a28d9bf00c22a5daef40",
"sha256:590044e3942351a1bdb1de960b739ff4ce277960f2425ad4509446dbace8d9d1"
],
"markers": "python_version > '2.7'",
"version": "==6.0.0"
},
"pathlib2": {
"hashes": [
"sha256:25199318e8cc3c25dcb45cbe084cc061051336d5a9ea2a12448d3d8cb748f742",
"sha256:5887121d7f7df3603bca2f710e7219f3eca0eb69e0b7cc6e0a022e155ac931a7"
],
"index": "pypi",
"version": "==2.3.3"
},
"pluggy": {
"hashes": [
"sha256:19ecf9ce9db2fce065a7a0586e07cfb4ac8614fe96edf628a264b1c70116cf8f",
"sha256:84d306a647cc805219916e62aab89caa97a33a1dd8c342e87a37f91073cd4746"
],
"version": "==0.9.0"
},
"py": {
"hashes": [
"sha256:64f65755aee5b381cea27766a3a147c3f15b9b6b9ac88676de66ba2ae36793fa",
"sha256:dc639b046a6e2cff5bbe40194ad65936d6ba360b52b3c3fe1d08a82dd50b5e53"
],
"version": "==1.8.0"
},
"pytest": {
"hashes": [
"sha256:592eaa2c33fae68c7d75aacf042efc9f77b27c08a6224a4f59beab8d9a420523",
"sha256:ad3ad5c450284819ecde191a654c09b0ec72257a2c711b9633d677c71c9850c4"
],
"index": "pypi",
"version": "==4.3.1"
},
"scandir": {
"hashes": [
"sha256:2586c94e907d99617887daed6c1d102b5ca28f1085f90446554abf1faf73123e",
"sha256:2ae41f43797ca0c11591c0c35f2f5875fa99f8797cb1a1fd440497ec0ae4b022",
"sha256:2b8e3888b11abb2217a32af0766bc06b65cc4a928d8727828ee68af5a967fa6f",
"sha256:2c712840c2e2ee8dfaf36034080108d30060d759c7b73a01a52251cc8989f11f",
"sha256:4d4631f6062e658e9007ab3149a9b914f3548cb38bfb021c64f39a025ce578ae",
"sha256:67f15b6f83e6507fdc6fca22fedf6ef8b334b399ca27c6b568cbfaa82a364173",
"sha256:7d2d7a06a252764061a020407b997dd036f7bd6a175a5ba2b345f0a357f0b3f4",
"sha256:8c5922863e44ffc00c5c693190648daa6d15e7c1207ed02d6f46a8dcc2869d32",
"sha256:92c85ac42f41ffdc35b6da57ed991575bdbe69db895507af88b9f499b701c188",
"sha256:b24086f2375c4a094a6b51e78b4cf7ca16c721dcee2eddd7aa6494b42d6d519d",
"sha256:cb925555f43060a1745d0a321cca94bcea927c50114b623d73179189a4e100ac"
],
"index": "pypi",
"version": "==1.10.0"
},
"six": {
"hashes": [
"sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c",
"sha256:d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73"
],
"version": "==1.12.0"
}
}
}

View File

@@ -100,7 +100,7 @@ For Windows users, before installing MoviePy by hand, go into the ``moviepy/conf
.. 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="@*" /> -->.
@@ -230,3 +230,4 @@ Maintainers
.. _`@earney`: https://github.com/earney
.. _`@kerstin`: https://github.com/kerstin
.. _`@mbeacom`: https://github.com/mbeacom
.. _`@overdrivr`: https://github.com/overdrivr

View File

@@ -1,49 +1,21 @@
# This file is used to configure the AppVeyor CI system, for testing on Windows machines.
#
# Code loosely based on https://github.com/ogrisel/python-appveyor-demo
#
# To test with AppVeyor:
# Register on appveyor.com with your GitHub account.
# Create a new appveyor project, using the GitHub details.
# Ideally, configure notifications to post back to GitHub. (Untested)
image: Visual Studio 2017
environment:
global:
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
# /E:ON and /V:ON options are not enabled in the batch script interpreter
# See: http://stackoverflow.com/a/13751649/163740
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd"
IMAGE_MAGICK_VERSION: 6.9.10-35-Q16
IMAGE_MAGICK_INSTALL_DIR: c://ImageMagick
matrix:
# MoviePy supports Python 3.4 onwards.
# Strategy:
# Test the latest known patch in each version
# Test the oldest and the newest 32 bit release. 64-bit otherwise.
- PYTHON: "C:\\Python34-x64"
PYTHON_VERSION: "3.4.5"
PYTHON_ARCH: "64"
MINICONDA: C:\Miniconda3-x64
CONDA_INSTALL: "numpy"
- PYTHON: "C:\\Python35-x64"
PYTHON_VERSION: "3.5.3"
PYTHON_ARCH: "64"
MINICONDA: C:\Miniconda35-x64
CONDA_INSTALL: "numpy"
ARCH: x64
- PYTHON: "C:\\Python36-x64"
PYTHON_VERSION: "3.6.2"
PYTHON_ARCH: "64"
MINICONDA: C:\Miniconda36-x64
CONDA_INSTALL: "numpy"
ARCH: x64
- PYTHON: "C:\\Python34"
PYTHON_VERSION: "3.6.2"
PYTHON_ARCH: "32"
MINICONDA: C:\Miniconda36
CONDA_INSTALL: "numpy"
- PYTHON: "C:\\Python37-x64"
PYTHON_ARCH: "64"
ARCH: x64
install:
# If there is a newer build queued for the same PR, cancel this one.
@@ -55,75 +27,40 @@ install:
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
# Dump some debugging information about the machine.
# - ECHO "Filesystem root:"
# - ps: "ls \"C:/\""
#
# - ECHO "Installed SDKs:"
# - ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""
#
# - ECHO "Installed projects:"
# - ps: "ls \"C:\\projects\""
# - ps: "ls \"C:\\projects\\moviepy\""
# - ECHO "Environment Variables"
# - set
# Prepend desired Python to the PATH of this build (this cannot be
# done from inside the powershell script as it would require to restart
# the parent CMD process).
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
# Prepare Miniconda.
- "ECHO Miniconda is installed in %MINICONDA%, and will be used to install %CONDA_INSTALL%"
- pip install --upgrade pip --user
- pip install pipenv
- "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%"
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
# Download ImageMagick installer (which also installs ffmpeg.)
# From http://ftp.fifi.org/ImageMagick/binaries/
# Might need to be updated from time to time
# Versions >=7.0 have problems - executables changed names.
# Assume 64-bit. Need to change to x86 for 32-bit.
- curl ftp.fifi.org/ImageMagick/binaries/ImageMagick-%IMAGE_MAGICK_VERSION%-%ARCH%-static.exe -o ImageMagick.exe
# Avoid warning from conda info.
- conda install -q -n root _license
# Dump the setup for debugging.
- conda info -a
# Install ImageMagick, telling InnoSetup to not open a window and change default install dir
- ImageMagick.exe /SILENT /SP /DIR="%IMAGE_MAGICK_INSTALL_DIR%"
# PIP finds some packages challenging. Let Miniconda install them.
- conda create --verbose -q -n test-environment python=%PYTHON_VERSION% %CONDA_INSTALL%
- activate test-environment
# Upgrade to the latest version of pip to avoid it displaying warnings
# about it being out of date.
- pip install --disable-pip-version-check --user --upgrade pip
- pip install --user --upgrade setuptools
# Install ImageMagick (which also installs ffmpeg.)
# This installation process is a big fragile, as new releases are issued, but no Conda package exists yet.
- "ECHO Downloading ImageMagick"
# Versions >=7.0 have problems - executables changed names.
# Assume 64-bit. Need to change to x86 for 32-bit.
# The available version at this site changes - each time it needs to be corrected in four places
# in the next few lines.
- curl -fskLO ftp://ftp.fifi.org/pub/ImageMagick/binaries/ImageMagick-6.9.9-5-Q16-x64-static.exe
- "ECHO Installing ImageMagick"
- "ImageMagick-6.9.9-5-Q16-x64-static.exe /verySILENT /SP"
- set IMAGEMAGICK_BINARY=c:\\Program Files\\ImageMagick-6.9.9-Q16\\convert.exe
- set FFMPEG_BINARY=c:\\Program Files\\ImageMagick-6.9.9-Q16\\ffmpeg.exe
# Check that we have the expected set-up.
- "ECHO We specified %PYTHON_VERSION% win%PYTHON_ARCH%"
- "python --version"
- "python -c \"import struct; print('Architecture is win'+str(struct.calcsize('P') * 8))\""
# Inspect contents and set env vars
- dir "%IMAGE_MAGICK_INSTALL_DIR%"
- set IMAGEMAGICK_BINARY=%IMAGE_MAGICK_INSTALL_DIR%//convert.exe
- echo %IMAGEMAGICK_BINARY%
- set FMPEG_BINARY="%IMAGE_MAGICK_INSTALL_DIR%//ffmpeg.exe"
- echo %FMPEG_BINARY%
build_script:
# Install all dependencies, including dev dependencies
- pipenv install --dev
# Build the compiled extension
- "%CMD_IN_ENV% python c:\\projects\\moviepy\\setup.py build"
#- "%CMD_IN_ENV% python c:\\projects\\moviepy\\setup.py build"
test_script:
# Run the project tests
- "%CMD_IN_ENV% python c:\\projects\\moviepy\\setup.py test"
- pipenv run pytest
# TODO: Support the post-test generation of binaries - Pending a version number that is supported (e.g. 0.3.0)
#

BIN
media/afterimage.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Binary file not shown.

BIN
media/crunching.mp3 Normal file

Binary file not shown.

BIN
media/fire2.mp4 Normal file

Binary file not shown.

BIN
media/matplotlib_demo1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
media/pigs_in_a_polka.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 KiB

BIN
media/python_logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

24
media/subtitles1.srt Normal file
View File

@@ -0,0 +1,24 @@
0
00:00:00,000 --> 00:00:04,000
Red!
1
00:00:05,000 --> 00:00:09,000
More Red!
2
00:00:10,000 --> 00:00:14,000
Green!
3
00:00:15,000 --> 00:00:19,000
More Green!
4
00:00:20,000 --> 00:00:24,000
Blue
5
00:00:25,000 --> 00:00:29,000
More Blue!

11
media/traj.txt Normal file
View File

@@ -0,0 +1,11 @@
# t(ms) x y
0 547 104
1000 210 78
2000 280 85
3000 337 93
4000 354 78
5000 381 68
6000 382 67
7000 382 67
8000 372 64
9000 372 65

BIN
media/vacation_2017.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

View File

@@ -13,45 +13,45 @@ class AudioFileClip(AudioClip):
read and stored in memory. this portion includes frames before
and after the last frames read, so that it is fast to read the sound
backward and forward.
Parameters
------------
filename
Either a soundfile name (of any extension supported by ffmpeg)
or an array representing a sound. If the soundfile is not a .wav,
it will be converted to .wav first, using the ``fps`` and
``bitrate`` arguments.
``bitrate`` arguments.
buffersize:
Size to load in memory (in number of frames)
Attributes
------------
nbytes
Number of bits per frame of the original audio file.
fps
Number of frames per second in the audio file
buffersize
See Parameters.
Lifetime
--------
Note that this creates subprocesses and locks files. If you construct one of these instances, you must call
close() afterwards, or the subresources will not be cleaned up until the process ends.
If copies are made, and close() is called on one, it may cause methods on the other copies to fail.
If copies are made, and close() is called on one, it may cause methods on the other copies to fail.
However, coreaders must be closed separately.
Examples
----------
>>> snd = AudioFileClip("song.wav")
>>> snd.close()
>>> snd = AudioFileClip("song.mp3", fps = 44100)
@@ -60,13 +60,13 @@ class AudioFileClip(AudioClip):
>>> snd.close()
>>> with AudioFileClip(mySoundArray, fps=44100) as snd: # from a numeric array
>>> pass # Close is implicitly performed by context manager.
"""
def __init__(self, filename, buffersize=200000, nbytes=2, fps=44100):
AudioClip.__init__(self)
self.filename = filename
self.reader = FFMPEG_AudioReader(filename, fps=fps, nbytes=nbytes,
buffersize=buffersize)
@@ -89,3 +89,6 @@ class AudioFileClip(AudioClip):
if self.reader:
self.reader.close_proc()
self.reader = None
def __del__(self):
self.close()

View File

@@ -117,7 +117,7 @@ class FFMPEG_AudioWriter:
raise IOError(error)
def close(self):
if self.proc:
if hasattr(self, 'proc') and self.proc:
self.proc.stdin.close()
self.proc.stdin = None
if self.proc.stderr is not None:
@@ -173,4 +173,4 @@ def ffmpeg_audiowrite(clip, filename, fps, nbytes, buffersize,
if write_logfile:
logfile.close()
logger(message="MoviePy - Done.")
logger(message="MoviePy - Done.")

View File

@@ -63,8 +63,6 @@ class FFMPEG_AudioReader:
self.initialize()
self.buffer_around(1)
def initialize(self, starttime = 0):
""" Opens the file, creates the pipe. """

View File

@@ -1,9 +1,9 @@
import os
import subprocess as sp
from .compat import DEVNULL
if os.name == 'nt':
try:
try:
import winreg as wr # py3k
except ImportError:
import _winreg as wr # py2k
@@ -11,24 +11,24 @@ if os.name == 'nt':
from .config_defaults import (FFMPEG_BINARY, IMAGEMAGICK_BINARY)
def try_cmd(cmd):
try:
popen_params = { "stdout": sp.PIPE,
"stderr": sp.PIPE,
"stdin": DEVNULL
}
try:
popen_params = {
"stdout": sp.PIPE,
"stderr": sp.PIPE,
"stdin": DEVNULL
}
# This was added so that no extra unwanted window opens on windows
# when the child process is created
if os.name == "nt":
popen_params["creationflags"] = 0x08000000
# This was added so that no extra unwanted window opens on windows
# when the child process is created
if os.name == "nt":
popen_params["creationflags"] = 0x08000000
proc = sp.Popen(cmd, **popen_params)
proc.communicate()
except Exception as err:
return False, err
else:
return True, None
proc = sp.Popen(cmd, **popen_params)
proc.communicate()
except Exception as err:
return False, err
else:
return True, None
if FFMPEG_BINARY=='ffmpeg-imageio':
from imageio.plugins.ffmpeg import get_exe
@@ -50,7 +50,7 @@ else:
" - The path specified for the ffmpeg binary might be wrong")
if IMAGEMAGICK_BINARY=='auto-detect':
if os.name == 'nt':
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"
@@ -62,6 +62,20 @@ if IMAGEMAGICK_BINARY=='auto-detect':
else:
IMAGEMAGICK_BINARY = 'unset'
else:
if not os.path.exists(IMAGEMAGICK_BINARY):
raise IOError(
"ImageMagick binary cannot be found at {}".format(
IMAGEMAGICK_BINARY
)
)
if not os.path.isfile(IMAGEMAGICK_BINARY):
raise IOError(
"ImageMagick binary found at {} is not a file".format(
IMAGEMAGICK_BINARY
)
)
success, err = try_cmd([IMAGEMAGICK_BINARY])
if not success:
raise IOError("%s - The path specified for the ImageMagick binary might "
@@ -69,7 +83,7 @@ else:
def get_setting(varname):
""" Returns the value of a configuration variable. """
""" Returns the value of a configuration variable. """
gl = globals()
if varname not in gl.keys():
raise ValueError("Unknown setting %s"%varname)

View File

@@ -196,6 +196,9 @@ class FFMPEG_VideoReader:
if hasattr(self, 'lastread'):
del self.lastread
def __del__(self):
self.close()
def ffmpeg_read_image(filename, with_mask=True):
""" Read an image file (PNG, BMP, JPEG...).
@@ -258,7 +261,7 @@ def ffmpeg_parse_infos(filename, print_infos=False, check_duration=True,
proc = sp.Popen(cmd, **popen_params)
(output, error) = proc.communicate()
infos = error.decode('utf8')
del proc
if print_infos:

View File

@@ -1,48 +0,0 @@
# -*- coding: utf-8 -*-
"""Handle retrieving media assets for testing."""
import os
from moviepy.video.io.downloader import download_webfile
def download_url(url, filename):
"""Download a file."""
if not os.path.exists(filename):
print('Downloading {} ...'.format(filename))
download_webfile(url, filename)
print('Downloading complete.')
def download_youtube_video(youtube_id, filename):
"""Download a video from youtube."""
# FYI.. travis-ci doesn't like youtube-dl
download_url(youtube_id, filename)
def download():
"""Initiate the media asset downloads."""
if not os.path.exists('media'):
os.mkdir('media')
# Define url prefix and path for all media assets.
github_prefix = 'https://github.com/earney/moviepy_media/raw/master/tests/'
output = 'media/{}'
urls = ['/images/python_logo.png', '/images/matplotlib_demo1.png',
'/images/afterimage.png', '/videos/big_buck_bunny_432_433.webm',
'/sounds/crunching.mp3', '/images/pigs_in_a_polka.gif',
'/videos/fire2.mp4', '/videos/big_buck_bunny_0_30.webm',
'/subtitles/subtitles1.srt', '/misc/traj.txt',
'/images/vacation_2017.jpg', '/images/python_logo_upside_down.png']
# Loop through download url strings, build out path, and download the asset.
for url in urls:
_, tail = os.path.split(url)
download_url(
url='{}/{}'.format(github_prefix, url),
filename=output.format(tail))
# Download remaining asset.
download_url(
url='https://data.vision.ee.ethz.ch/cvl/video2gif/kAKZeIzs0Ag.mp4',
filename='media/video_with_failing_audio.mp4')
if __name__ == "__main__":
download()

View File

@@ -9,30 +9,26 @@ import pytest
from moviepy.audio.io.AudioFileClip import AudioFileClip
from moviepy.audio.AudioClip import AudioClip, concatenate_audioclips, CompositeAudioClip
sys.path.append("tests")
from . import download_media
from .test_helper import TMP_DIR
def test_download_media(capsys):
with capsys.disabled():
download_media.download()
def test_audio_coreader():
if sys.platform.startswith("win"):
pytest.skip("Temporarily skipping on windows because otherwise test suite fails with Invalid Handle Error")
sound = AudioFileClip("media/crunching.mp3")
sound = sound.subclip(1, 4)
sound2 = sound.coreader()
sound2 = AudioFileClip("media/crunching.mp3")
sound2.write_audiofile(os.path.join(TMP_DIR, "coreader.mp3"))
def test_audioclip():
make_frame = lambda t: [sin(440 * 2 * pi * t)]
clip = AudioClip(make_frame, duration=2, fps=22050)
clip.write_audiofile(os.path.join(TMP_DIR, "audioclip.mp3"))
def test_audioclip_concat():
if sys.platform.startswith("win"):
pytest.skip("Temporarily skipping on windows because otherwise test suite fails with Invalid Handle Error")
make_frame_440 = lambda t: [sin(440 * 2 * pi * t)]
make_frame_880 = lambda t: [sin(880 * 2 * pi * t)]
@@ -51,6 +47,9 @@ def test_audioclip_concat():
def test_audioclip_with_file_concat():
if sys.platform.startswith("win"):
pytest.skip("Temporarily skipping on windows because otherwise test suite fails with Invalid Handle Error")
make_frame_440 = lambda t: [sin(440 * 2 * pi * t)]
clip1 = AudioClip(make_frame_440, duration=1, fps=44100)
@@ -66,6 +65,9 @@ def test_audioclip_with_file_concat():
def test_audiofileclip_concat():
if sys.platform.startswith("win"):
pytest.skip("Temporarily skipping on windows because otherwise test suite fails with Invalid Handle Error")
sound = AudioFileClip("media/crunching.mp3")
sound = sound.subclip(1, 4)
@@ -75,6 +77,5 @@ def test_audiofileclip_concat():
concat.write_audiofile(os.path.join(TMP_DIR, "concat_audio_file.mp3"))
if __name__ == "__main__":
pytest.main()

View File

@@ -6,14 +6,8 @@ import sys
import pytest
from moviepy.video.io.ImageSequenceClip import ImageSequenceClip
sys.path.append("tests")
from . import download_media
from .test_helper import TMP_DIR
def test_download_media(capsys):
with capsys.disabled():
download_media.download()
def test_1():
images=[]
durations=[]

View File

@@ -11,18 +11,8 @@ from moviepy.video.VideoClip import ColorClip, ImageClip, TextClip
from moviepy.video.compositing.CompositeVideoClip import CompositeVideoClip
from moviepy.utils import close_all_clips
sys.path.append("tests")
from .test_helper import TMP_DIR, FONT
def test_download_media(capsys):
"""Test downloading."""
from . import download_media
with capsys.disabled():
download_media.download()
def test_PR_306():
assert TextClip.list('font') != []

View File

@@ -5,7 +5,6 @@ from moviepy.utils import close_all_clips
from moviepy.video.fx.blink import blink
from moviepy.video.VideoClip import TextClip
sys.path.append("tests")
from .test_helper import TMP_DIR
def test_duration():

View File

@@ -11,16 +11,8 @@ from moviepy.audio.io.AudioFileClip import AudioFileClip
from moviepy.video.fx.speedx import speedx
from moviepy.utils import close_all_clips
sys.path.append("tests")
from . import download_media
from .test_helper import TMP_DIR
def test_download_media(capsys):
with capsys.disabled():
download_media.download()
def test_check_codec():
clip = VideoFileClip("media/big_buck_bunny_432_433.webm")
location = os.path.join(TMP_DIR, "not_a_video.mas")

View File

@@ -9,7 +9,6 @@ from moviepy.video.VideoClip import ColorClip
from moviepy.video.io.VideoFileClip import VideoFileClip
from moviepy.utils import close_all_clips
sys.path.append("tests")
from .test_helper import TMP_DIR
def test_setup():
@@ -44,4 +43,4 @@ def test_ffmpeg_resizing():
if __name__ == '__main__':
pytest.main()
pytest.main()

View File

@@ -8,15 +8,8 @@ from moviepy.video.compositing.CompositeVideoClip import CompositeVideoClip
from moviepy.video.fx.mask_color import mask_color
from moviepy.video.VideoClip import ColorClip, ImageClip
from . import download_media
sys.path.append("tests")
from .test_helper import TMP_DIR
def test_download_media(capsys):
with capsys.disabled():
download_media.download()
def test_afterimage():
ai = ImageClip("media/afterimage.png")
masked_clip = mask_color(ai, color=[0,255,1]) # for green

View File

@@ -5,7 +5,6 @@ import sys
import pytest
from moviepy.editor import *
from moviepy.utils import close_all_clips
sys.path.append("tests")
from .test_helper import TMP_DIR

View File

@@ -9,15 +9,10 @@ TODO:
#
# import pytest
#
# from . import download_media
# from .test_helper import PYTHON_VERSION, TMP_DIR, TRAVIS
#
# sys.path.append("tests")
#
#
# def test_download_media(capsys):
# with capsys.disabled():
# download_media.download()
#
# def test_matplotlib():
# #for now, python 3.5 installs a version of matplotlib that complains

View File

@@ -1,19 +1,10 @@
# -*- coding: utf-8 -*-
"""FFmpeg reader tests meant to be run with pytest."""
import sys
import pytest
from moviepy.video.io.ffmpeg_reader import ffmpeg_parse_infos
from . import download_media
sys.path.append("tests")
def test_download_media(capsys):
with capsys.disabled():
download_media.download()
def test_ffmpeg_parse_infos():
d=ffmpeg_parse_infos("media/big_buck_bunny_432_433.webm")
assert d['duration'] == 1.0

View File

@@ -25,17 +25,8 @@ from moviepy.audio.fx.audio_normalize import audio_normalize
from moviepy.audio.io.AudioFileClip import AudioFileClip
from moviepy.video.io.VideoFileClip import VideoFileClip
sys.path.append("tests")
from . import download_media
from .test_helper import TMP_DIR
def test_download_media(capsys):
with capsys.disabled():
download_media.download()
def get_test_video():
return VideoFileClip("media/big_buck_bunny_432_433.webm").subclip(0, 1)
@@ -86,7 +77,7 @@ def test_fadein():
clip1 = fadein(clip, 0.5)
clip1.write_videofile(os.path.join(TMP_DIR, "fadein1.webm"))
close_all_clips(locals())
def test_fadeout():
clip = get_test_video()

View File

@@ -7,19 +7,11 @@ import pytest
from moviepy.editor import *
from moviepy.utils import close_all_clips
sys.path.append("tests")
from . import download_media
from .test_helper import PYTHON_VERSION, TMP_DIR, TRAVIS
from moviepy.video.fx.blink import blink
from moviepy.video.fx.resize import resize
def test_download_media(capsys):
with capsys.disabled():
download_media.download()
def test_issue_145():
video = ColorClip((800, 600), color=(255, 0, 0)).set_duration(5)
with pytest.raises(Exception, message='Expecting Exception'):

View File

@@ -10,17 +10,8 @@ from moviepy.video.tools.subtitles import SubtitlesClip, file_to_subtitles
from moviepy.video.VideoClip import ColorClip, TextClip
from moviepy.video.io.VideoFileClip import VideoFileClip
from . import download_media
from .test_helper import TMP_DIR, FONT
sys.path.append("tests")
def test_download_media(capsys):
with capsys.disabled():
download_media.download()
def test_cuts1():
clip = VideoFileClip("media/big_buck_bunny_432_433.webm").resize(0.2)
cuts.find_video_period(clip) == pytest.approx(0.966666666667, 0.0001)

View File

@@ -5,10 +5,8 @@ import os
from moviepy.video.tools.credits import credits1
sys.path.append("tests")
from .test_helper import TMP_DIR
def test_credits():
credit_file = "# This is a comment\n" \
"# The next line says : leave 4 blank lines\n" \