Video editing with Python
add Dockerfile (#522)
Billy Earney2a71175020a0
diff --git a/Dockerfile b/Dockerfilenew file mode 100644index 00000000..7834d00d--- /dev/null+++ b/Dockerfile@@ -0,0 +1,32 @@+FROM python:3++# Install numpy using system package manager+RUN apt-get -y update && apt-get -y install libav-tools imagemagick libopencv-dev python-opencv++# Install some special fonts we use in testing, etc..+RUN apt-get -y install fonts-liberation++RUN apt-get install -y locales && \+ locale-gen C.UTF-8 && \+ /usr/sbin/update-locale LANG=C.UTF-8++ENV LC_ALL C.UTF-8++# do we need all of these, maybe remove some of them?+RUN pip install imageio numpy scipy matplotlib pandas sympy nose decorator tqdm pillow pytest++# install scikit-image after the other deps, it doesn't cause errors this way.+RUN pip install scikit-image sklearn++ADD . /var/src/moviepy/+#RUN git clone https://github.com/Zulko/moviepy.git /var/src/moviepy+RUN cd /var/src/moviepy/ && python setup.py install++# install ffmpeg from imageio.+RUN python -c "import imageio; imageio.plugins.ffmpeg.download()"++#add soft link so that ffmpeg can executed (like usual) from command line+RUN ln -s /root/.imageio/ffmpeg/ffmpeg.linux64 /usr/bin/ffmpeg++# modify ImageMagick policy file so that Textclips work correctly.+RUN cat /etc/ImageMagick-6/policy.xml | sed 's/none/read,write/g'> /etc/ImageMagick-6/policy.xmldiff --git a/docs/docker.rst b/docs/docker.rstnew file mode 100644index 00000000..7d503323--- /dev/null+++ b/docs/docker.rst@@ -0,0 +1,42 @@+Moviepy Docker+===============++Prequisites+-------------++1. Docker installed `Docker for Mac, Docker for windows, linux, etc <https://www.docker.com/get-docker/>`_+2. Build the Dockerfile ::++ docker build -t moviepy -f Dockerfile .+++Steps to run the git repo unittests from docker+------------------------------------------------++Get a bash prompt in the moviepy container ::++ cd tests+ docker run -it -v `pwd`:/tests moviepy bash++Run the tests ::++ cd tests+ python test_issues.py++Running your own moviepy script from docker+--------------------------------------------++Change directory to where your script is located++If moviepy docker container is already running, you can connect by: ::++ docker exec -it moviepy python myscript.py++If the container isn't running already ::++ docker run -it moviepy bash+ python myscript.py++You can also start a container and run a script in one command: ::++ docker run -it -v `pwd`:/code moviepy python myscript.pydiff --git a/docs/index.rst b/docs/index.rstindex 53d2b96c..3d644954 100644--- a/docs/index.rst+++ b/docs/index.rst@@ -26,6 +26,7 @@ User Guidegetting_started/getting_startedgalleryexamples/examples+ dockerFAQref/refdiff --git a/tests/test_PR.py b/tests/test_PR.pyindex d4a7bab3..64e84633 100644--- a/tests/test_PR.py+++ b/tests/test_PR.py@@ -8,29 +8,41 @@ import pytestfrom moviepy.editor import *+import sys+sys.path.append("tests")+import download_media+from test_helper import PYTHON_VERSION, TMP_DIR, TRAVIS++def test_download_media(capsys):+ with capsys.disabled():+ download_media.download()def test_PR_306():+ if TRAVIS:+ return+#put this back in once we get ImageMagick working on travis-ci- #assert TextClip.list('font') != []- #assert TextClip.list('color') != []+ assert TextClip.list('font') != []+ assert TextClip.list('color') != []- #with pytest.raises(Exception, message="Expecting Exception"):- # TextClip.list('blah')- pass+ with pytest.raises(Exception, message="Expecting Exception"):+ TextClip.list('blah')def test_PR_339():+ if TRAVIS:+ return+#in caption mode- #overlay = TextClip(txt='foo',- # color='white',- # size=(640, 480),- # method='caption',- # align='center',- # fontsize=25)+ overlay = TextClip(txt='foo',+ color='white', font="Liberation-Mono",+ size=(640, 480),+ method='caption',+ align='center',+ fontsize=25)#in_label_mode- #overlay = TextClip(txt='foo', method='label')- pass+ overlay = TextClip(txt='foo', font="Liberation-Mono", method='label')def test_PR_424():@@ -44,7 +56,8 @@ def test_PR_424():def test_PR_458():clip = ColorClip([1000, 600], color=(60, 60, 60), duration=10)- clip.write_videofile("test.mp4", progress_bar=False, fps=30)+ clip.write_videofile(os.path.join(TMP_DIR, "test.mp4"),+ progress_bar=False, fps=30)def test_PR_515():diff --git a/tests/test_misc.py b/tests/test_misc.pyindex 7376166b..dfeee7cb 100644--- a/tests/test_misc.py+++ b/tests/test_misc.py@@ -31,7 +31,7 @@ def test_subtitles():if TRAVIS:return- generator = lambda txt: TextClip(txt, font='Georgia-Regular',+ generator = lambda txt: TextClip(txt, font='Liberation-Mono',size=(800,600), fontsize=24,method='caption', align='South',color='white')