Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update #5

Merged
merged 98 commits into from
Feb 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
4e60a71
Fixed copy-paste typo
temerick Aug 24, 2015
f0372ad
Fixed missing list
Sep 20, 2015
efaba09
fixed module hierarchy for Trajectory
bwagner Oct 7, 2015
2153c20
fixed addy
bwagner Oct 7, 2015
3ae11f5
small recipe
Dec 23, 2015
8d0cc38
on_color function docstring has wrong parameter
cblument Dec 28, 2015
f0dc512
Update README.rst
tcyrus Jan 26, 2016
8986d2f
fix deprecation message
mgaitan Jun 16, 2016
85c631d
ImageSequenceClip: Check for fps and durations rather than fps and du…
jeromegrosse Oct 10, 2016
33e2975
Add a test case.
Oct 17, 2016
870a5f4
Add another test
Oct 17, 2016
814b776
ensures int arguments to np.reshape; closes #383
tyarkoni Jan 16, 2017
04b6bc6
fix issue #401
Feb 10, 2017
6453c7f
Merge pull request #405 from Gloin1313/master
Zulko Feb 14, 2017
05e88b7
Merge pull request #2 from Zulko/master
bearney74 Feb 14, 2017
015f9a3
fix issue #335
Feb 15, 2017
afa1eb3
Update maintainer section in README
mbeacom Feb 15, 2017
eb32bc1
Merge pull request #409 from mbeacom/fix-readme
Feb 15, 2017
212db1f
Merge pull request #403 from earney/master
Feb 15, 2017
a49be81
Merge pull request #384 from tyarkoni/master
Feb 15, 2017
ef83248
Merge pull request #3 from Zulko/master
bearney74 Feb 15, 2017
ceb4076
Merge pull request #244 from cblument/doc_fix
Feb 15, 2017
13ac192
Merge pull request #4 from Zulko/master
bearney74 Feb 15, 2017
a87b99b
make concatenate_videoclips Python 3 compatible.. fix issue #313
Feb 15, 2017
3137695
Merge pull request #410 from earney/master
Feb 15, 2017
bed4266
Increment release version
mbeacom Feb 15, 2017
20a70f0
CompositeVideoClip doesn't accept an argument of transparent
Feb 15, 2017
a5a575a
move PY3 variable to compat.py
Feb 15, 2017
8a7f841
Merge pull request #5 from Zulko/master
bearney74 Feb 15, 2017
8c1aaa5
fix movie => moviepy typo
Feb 15, 2017
cec4511
fix issue #341
Feb 15, 2017
a38e4cd
Merge branch 'master' of github.com:earney/moviepy
Feb 15, 2017
2f824b0
Merge pull request #411 from earney/master
bearney74 Feb 15, 2017
e3480c6
Fixed typo #375
Feb 15, 2017
16d7c81
Merge pull request #6 from Zulko/master
bearney74 Feb 15, 2017
f4a4606
fix issue #357, which makes real problem more obvious (media file doe…
Feb 15, 2017
75bc1af
Merge pull request #243 from zodman/master
bearney74 Feb 15, 2017
f7ad6be
Revert "small recipe (mirroring a video)"
Zulko Feb 15, 2017
54bdeeb
Merge pull request #414 from Zulko/revert-243-master
Zulko Feb 15, 2017
ca009a3
Merge pull request #7 from Zulko/master
bearney74 Feb 15, 2017
118f952
Merge pull request #302 from mgaitan/patch-2
Feb 16, 2017
fb023fb
Merge pull request #254 from tcyrus/patch-1
Feb 16, 2017
1381b38
Merge pull request #8 from Zulko/master
bearney74 Feb 16, 2017
64871cf
Merge pull request #331 from jeromegrosse/bug-imagesequenceclip-duration
bearney74 Feb 17, 2017
c7e46a0
Merge branch 'master' of https://github.com/Zulko/moviepy
tburrows13 Feb 18, 2017
58f9022
Fixed indentation
Feb 18, 2017
2b9b14b
.gitignore ignore Mac-specific files, Jetbrains settings dir
kerstin Feb 19, 2017
0360aee
README.rst make mention of Gitter, add PyPI and Gitter badge
kerstin Feb 19, 2017
24c538a
README.rst wording, formatting
kerstin Feb 19, 2017
8ab44ea
README.rst structure link targets, add co-maintainers (with @username)
kerstin Feb 19, 2017
11cc67d
README.rst move maintainers, contributing sections; change docs x-ref…
kerstin Feb 19, 2017
fdd9413
README.rst fix grammar
kerstin Feb 19, 2017
3d91ddd
Merge pull request #413 from earney/master
bearney74 Feb 20, 2017
b4cf52f
fix issue 145. raise Exception when concatenate method != chain or c…
bearney74 Feb 20, 2017
1bb1e3c
make PEP8 compatible
bearney74 Feb 20, 2017
35b4e5e
Merge pull request #428 from earney/issue_145
Zulko Feb 20, 2017
edbb772
Merge pull request #425 from kerstin/readme_improvements
kerstin Feb 20, 2017
639e449
fix PR #413 . (issue #357)
bearney74 Feb 20, 2017
5ef16e9
Merge pull request #429 from earney/issue_145
bearney74 Feb 20, 2017
f8092d0
Merge pull request #1 from Zulko/master
bearney74 Feb 20, 2017
ed4adbe
create test for issue #145
bearney74 Feb 20, 2017
19d4f03
add tests/media to .gitignore
bearney74 Feb 21, 2017
d3582b1
Merge pull request #431 from earney/pytest
bearney74 Feb 21, 2017
360a407
Merge pull request #2 from Zulko/master
bearney74 Feb 21, 2017
66c061f
Merge pull request #339 from drewm1980/master
bearney74 Feb 21, 2017
cbbb276
Merge pull request #3 from Zulko/master
bearney74 Feb 21, 2017
2e036d3
Merge pull request #197 from temerick/patch-1
bearney74 Feb 21, 2017
e4d9032
Merge pull request #211 from LunarLanding/patch-1
bearney74 Feb 21, 2017
ce38d41
Merge pull request #215 from bwagner/master
bearney74 Feb 21, 2017
fca1727
fix Issue #385 , no DirectoryClip class (#434)
bearney74 Feb 21, 2017
3870506
fix issue 417, unicode has no attribute 'shape' error.
bearney74 Feb 22, 2017
3ec5106
add test for issue 417
bearney74 Feb 22, 2017
3d877cb
add test for issue 417
bearney74 Feb 22, 2017
32b7007
Fixed resize documentation issue #319 (#346)
jmisacube Feb 22, 2017
fe3474e
Merge pull request #4 from Zulko/master
bearney74 Feb 22, 2017
df31c03
Handle bytes when listing fonts in VideoClip.py (#306)
Zowie Feb 22, 2017
c019484
Merge pull request #5 from Zulko/master
bearney74 Feb 22, 2017
f07e6a3
add test for PR306
bearney74 Feb 22, 2017
ba1dd25
add test for PR306 (#440)
bearney74 Feb 22, 2017
319a52d
Merge pull request #6 from Zulko/master
bearney74 Feb 22, 2017
372177a
create test file for pull requests (#433)
bearney74 Feb 23, 2017
09d3572
Test issue 407 (video has a valid fps after concatenate function) (#443)
bearney74 Feb 23, 2017
674b1d7
Merge pull request #7 from Zulko/master
bearney74 Feb 23, 2017
fd36a54
Move PR test to test_PR.py file (#444)
bearney74 Feb 23, 2017
4446225
fix merge issue, add code to add python image for tests
bearney74 Feb 23, 2017
8c41594
Merge branch 'earney-issue417'
bearney74 Feb 23, 2017
9e6b9c8
add code to download python_logo.png
bearney74 Feb 23, 2017
ff44f23
Merge branch 'master' into issue417
bearney74 Feb 23, 2017
b3dba11
Merge branch 'master' into master
bearney74 Feb 23, 2017
83ed8a5
Merge pull request #438 from earney/issue417
bearney74 Feb 24, 2017
b1016cb
remove duplicate test_issue_417 function
bearney74 Feb 24, 2017
ff82fe8
add testing with travis-ci (#447)
bearney74 Feb 26, 2017
ec57a19
put DEVNULL into compat.py (#432)
bearney74 Feb 26, 2017
e8d124a
add travis-ci badge to readme file
bearney74 Feb 26, 2017
c0f6925
pick highest fps when concatenating (#416)
BrianLee608 Feb 27, 2017
5eb43c9
add test for issue 416
bearney74 Feb 27, 2017
04bb711
fix test_issue_416
bearney74 Feb 27, 2017
b8bc801
Merge branch 'master' into master
Feb 27, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,15 @@ nosetests.xml
.pydevproject

# Temp files

*~

# Pipy codes

.pypirc

# Mac
.DS_Store

# JetBrains
.idea

tests/media
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: python
python:
- "2.7"
- "3.3"
- "3.4"
- "3.5"
- "3.6"
# command to install dependencies
before_install:
- sudo apt-get -qq update
- sudo apt-get install -y ffmpeg
- mkdir media
install:
- python setup.py install
# command to run tests
script: py.test
105 changes: 66 additions & 39 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
MoviePy
========

MoviePy (full documentation here_) is a Python module for video editing: cuts, concatenations, title insertions, video compositing (a.k.a. non-linear editing), video processing, and creation of custom effects. See the gallery_ for some examples of use.
=======

.. image:: https://badge.fury.io/py/moviepy.svg
:target: PyPI_
:alt: MoviePy page on the Python Package Index
.. image:: https://badges.gitter.im/movie-py/gitter.png
:target: Gitter_
:alt: Discuss MoviePy on Gitter
.. image:: https://travis-ci.org/Zulko/moviepy.svg?branch=master
:target: https://travis-ci.org/Zulko/moviepy
:alt: Build status on travis-ci

MoviePy (full documentation_) is a Python module for video editing: cutting, concatenations, title insertions, video compositing (a.k.a. non-linear editing), video processing, and creation of custom effects. See the gallery_ for some examples of use.

MoviePy can read and write all the most common audio and video formats, including GIF, and runs on Windows/Mac/Linux, with Python 2.7+ and 3. Here it is in action in an IPython notebook:

Expand All @@ -10,9 +20,11 @@ MoviePy can read and write all the most common audio and video formats, includin
:align: center

Example
--------
-------

In this example we open a video file, select the subclip between t=50s and t=60s, add a title at the center of the screen, and write the result to a new file:

In this example we open a video file, select the subclip between t=50s and t=60s, add a title at the center of the screen, and write the result to a new file: ::
.. code:: python

from moviepy.editor import *

Expand All @@ -27,76 +39,91 @@ In this example we open a video file, select the subclip between t=50s and t=60s
result.write_videofile("myHolidays_edited.webm",fps=25) # Many options...


Installation
------------

Contribute !
-------------
MoviePy depends on the Python modules Numpy_, imageio_, Decorator_, and tqdm_, which will be automatically installed during MoviePy's installation. The software FFMPEG should be automatically downloaded/installed (by imageio) during your first use of MoviePy (installation will take a few seconds). If you want to use a specific version of FFMPEG, follow the instructions in ``config_defaults.py``. In case of trouble, provide feedback.

MoviePy is an open-source software originally written by Zulko_ and released under the MIT licence. The project is hosted on Github_ , where everyone is welcome to contribute, ask for help or simply give feedback.
**Installation by hand:** download the sources, either from PyPI_ or, if you want the development version, from Github_, unzip everything into one folder, open a terminal and type: ::

You can also discuss about the project on Reddit_ or on the mailing list moviepy@librelist.com .
$ (sudo) python setup.py install

**Installation with pip:** if you have ``pip`` installed, just type this in a terminal: ::

Maintainers
--------------
$ (sudo) pip install moviepy

- [Zulko](https://github.com/Zulko/) - Owner
- [mbeacom](https://github.com/mbeacom/)
If you have neither ``setuptools`` nor ``ez_setup`` installed, the command above will fail. In this case type this before installing: ::

$ (sudo) pip install ez_setup

Installation
---------------

MoviePy depends on the Python modules Numpy_, imageio_, Decorator_, and tqdm_, which will be automatically installed during MoviePy's installation. The software 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, follow the instructions in file ``config_defaults.py``. In case of trouble, provide feedback.
Optional but useful dependencies
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

**Installation 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 ::
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.

(sudo) python setup.py install
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 ::

**Installation with pip:** if you have ``pip`` installed, just type this in a terminal: ::
IMAGEMAGICK_BINARY = "C:\\Program Files\\ImageMagick_VERSION\\convert.exe"

(sudo) pip install moviepy
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).

If you have neither ``setuptools`` nor ``ez_setup`` installed the command above will fail, is this case type this before installing: ::
For advanced image processing, you will need one or several of the following packages:

(sudo) pip install ez_setup
- The Python Imaging Library (PIL) or, even better, its branch Pillow_.
- Scipy_ (for tracking, segmenting, etc.) can be used to resize video clips if PIL and OpenCV are not installed.
- `Scikit Image`_ may be needed for some advanced image manipulation.
- `OpenCV 2.4.6`_ or a more recent version (one that provides the package ``cv2``) may be needed for some advanced image manipulation.

For instance, using the method ``clip.resize`` requires that at least one of Scipy, PIL, Pillow or OpenCV is installed.

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.
Contribute
----------

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 `convert`. It should look like this ::
MoviePy is open-source software originally written by Zulko_ and released under the MIT licence. The project is hosted on Github_, where everyone is welcome to contribute, ask for help or simply give feedback.

You can also discuss the project on Reddit_ (preferred over GitHub issues for usage/examples), Gitter_ or the mailing list moviepy@librelist.com.

IMAGEMAGICK_BINARY = "C:\\Program Files\\ImageMagick_VERSION\\convert.exe"

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*).
Maintainers
-----------

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.
- Zulko_ (owner)

- 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.
- `Scikit Image`_ may be needed for some advanced image manipulation.
- `OpenCV 2.4.6`_ or more recent (which provides the package ``cv2``) may be needed for some advanced image manipulation.
- `@Gloin1313`_
- `@earney`_
- Kay `@kerstin`_
- `@mbeacom`_


.. MoviePy links
.. _gallery: http://zulko.github.io/moviepy/gallery.html
.. _documentation: http://zulko.github.io/moviepy/
.. _`download MoviePy`: https://github.com/Zulko/moviepy

.. Websites, Platforms
.. _Reddit: http://www.reddit.com/r/moviepy/
.. _PyPI: https://pypi.python.org/pypi/moviepy
.. _Pillow: http://pillow.readthedocs.org/en/latest/
.. _Zulko : https://github.com/Zulko
.. _Github: https://github.com/Zulko/moviepy
.. _here: http://zulko.github.io/moviepy/
.. _Gitter: https://gitter.im/movie-py/Lobby

.. Software, Tools, Libraries
.. _Pillow: http://pillow.readthedocs.org/en/latest/
.. _Scipy: http://www.scipy.org/
.. _`download MoviePy`: https://github.com/Zulko/moviepy
.. _`OpenCV 2.4.6`: http://sourceforge.net/projects/opencvlibrary/files/
.. _Pygame: http://www.pygame.org/download.shtml
.. _Numpy: http://www.scipy.org/install.html
.. _imageio: http://imageio.github.io/
.. _`Scikit Image`: http://scikit-image.org/download.html
.. _Decorator: https://pypi.python.org/pypi/decorator
.. _tqdm: https://github.com/noamraph/tqdm


.. _ffmpeg: http://www.ffmpeg.org/download.html
.. _ImageMagick: http://www.imagemagick.org/script/index.php

.. People
.. _Zulko: https://github.com/Zulko
.. _`@Gloin1313`: https://github.com/Gloin1313
.. _`@earney`: https://github.com/earney
.. _`@kerstin`: https://github.com/kerstin
.. _`@mbeacom`: https://github.com/mbeacom
2 changes: 1 addition & 1 deletion examples/moving_letters.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
txtClip = TextClip('Cool effect',color='white', font="Amiri-Bold",
kerning = 5, fontsize=100)
cvc = CompositeVideoClip( [txtClip.set_pos('center')],
size=screensize, transparent=True)
size=screensize)

# THE NEXT FOUR FUNCTIONS DEFINE FOUR WAYS OF MOVING THE LETTERS

Expand Down
4 changes: 4 additions & 0 deletions moviepy/Clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,10 @@ def subclip(self, t_start=0, t_end=None):
they exist.
"""

if t_start < 0: #make this more python like a negative value
#means to move backward from the end of the clip
t_start = self.duration + t_start #remeber t_start is negative

if (self.duration is not None) and (t_start>self.duration):

raise ValueError("t_start (%.02f) "%t_start +
Expand Down
17 changes: 9 additions & 8 deletions moviepy/audio/io/ffmpeg_audiowriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
import numpy as np
import subprocess as sp

from moviepy.compat import PY3, DEVNULL

import os
try:
from subprocess import DEVNULL # py3k
except ImportError:
DEVNULL = open(os.devnull, 'wb')

from tqdm import tqdm
from moviepy.config import get_setting
Expand Down Expand Up @@ -82,14 +80,17 @@ def __init__(self, filename, fps_input, nbytes=2,

def write_frames(self,frames_array):
try:
self.proc.stdin.write(frames_array.tostring())
if PY3:
self.proc.stdin.write(frames_array.tobytes())
else:
self.proc.stdin.write(frames_array.tostring())
except IOError as err:
ffmpeg_error = self.proc.stderr.read()
error = (str(err)+ ("\n\nMoviePy error: FFMPEG encountered "
"the following error while writing file %s:"%self.filename
+ "\n\n"+ffmpeg_error))

if "Unknown encoder" in ffmpeg_error:
if b"Unknown encoder" in ffmpeg_error:

error = (error+("\n\nThe audio export failed because "
"FFMPEG didn't find the specified codec for audio "
Expand All @@ -99,7 +100,7 @@ def write_frames(self,frames_array):
" >>> to_videofile('myvid.mp4', audio_codec='libmp3lame')"
)%(self.codec))

elif "incorrect codec parameters ?" in ffmpeg_error:
elif b"incorrect codec parameters ?" in ffmpeg_error:

error = error+("\n\nThe audio export "
"failed, possibly because the codec specified for "
Expand All @@ -108,7 +109,7 @@ def write_frames(self,frames_array):
"argument in to_videofile. This would be 'libmp3lame' "
"for mp3, 'libvorbis' for ogg...")%(self.codec, self.ext)

elif "encoder setup failed":
elif b"encoder setup failed" in ffmpeg_error:

error = error+("\n\nThe audio export "
"failed, possily because the bitrate you specified "
Expand Down
13 changes: 4 additions & 9 deletions moviepy/audio/io/readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@

from moviepy.video.io.ffmpeg_reader import ffmpeg_parse_infos
from moviepy.config import get_setting

from moviepy.compat import PY3, DEVNULL
import os
try:
from subprocess import DEVNULL # py3k
except ImportError:
DEVNULL = open(os.devnull, 'wb')


class FFMPEG_AudioReader:
Expand Down Expand Up @@ -114,12 +110,14 @@ def skip_chunk(self,chunksize):


def read_chunk(self,chunksize):
# chunksize is not being autoconverted from float to int
chunksize = int(round(chunksize))
L = self.nchannels*chunksize*self.nbytes
s = self.proc.stdout.read(L)
dt = {1: 'int8',2:'int16',4:'int32'}[self.nbytes]
result = np.fromstring(s, dtype=dt)
result = (1.0*result / 2**(8*self.nbytes-1)).\
reshape((len(result)/self.nchannels,
reshape((int(len(result)/self.nchannels),
self.nchannels))
#self.proc.stdout.flush()
self.pos = self.pos+chunksize
Expand Down Expand Up @@ -238,6 +236,3 @@ def buffer_around(self,framenumber):

def __del__(self):
self.close_proc()



8 changes: 8 additions & 0 deletions moviepy/compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import os
import sys
PY3=sys.version_info.major >= 3

if PY3:
from subprocess import DEVNULL # py3k
else:
DEVNULL = open(os.devnull, 'wb')
7 changes: 1 addition & 6 deletions moviepy/config.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import os
import subprocess as sp
try:
from subprocess import DEVNULL # py3k
except ImportError:
DEVNULL = open(os.devnull, 'wb')
from .compat import DEVNULL

if os.name == 'nt':
try:
Expand Down Expand Up @@ -103,5 +100,3 @@ def change_settings(new_settings={}, file=None):
print( "MoviePy : ImageMagick successfully found." )
else:
print( "MoviePy : can't find or access ImageMagick." )


7 changes: 2 additions & 5 deletions moviepy/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
import re

import os
try:
from subprocess import DEVNULL # py3k
except ImportError:
DEVNULL = open(os.devnull, 'wb')
from .compat import DEVNULL


def sys_write_flush(s):
Expand Down Expand Up @@ -156,4 +153,4 @@ def find_extension(codec):
for ext,infos in extensions_dict.items():
if ('codec' in infos) and codec in infos['codec']:
return ext
raise ValueError
raise ValueError
2 changes: 1 addition & 1 deletion moviepy/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.2.12"
__version__ = "0.2.2.13"
Loading