Skip to content

Video editing with Python

Now you can do clip.resize instead of clip.vfx( fx.resize, )

Zulkoa49b2feb37c3
diff --git a/docs/_themes/flask/layout.html b/docs/_themes/flask/layout.html
index 5caa4e29..56ae04bc 100644
--- a/docs/_themes/flask/layout.html
+++ b/docs/_themes/flask/layout.html
@@ -2,7 +2,7 @@
{%- block extrahead %}
{{ super() }}
{% if theme_touch_icon %}
- <link rel="apple-touch-icon" href="{{ pathto('_static/' ~ theme_touch_icon, 1) }}" />
+ <link rel="orange-touch-icon" href="{{ pathto('_static/' ~ theme_touch_icon, 1) }}" />
{% endif %}
<link media="only screen and (max-device-width: 480px)" href="{{
pathto('_static/small_flask.css', 1) }}" type= "text/css" rel="stylesheet" />
diff --git a/docs/crash_course/crash_course.rst b/docs/crash_course/crash_course.rst
index 174b483e..2afcce36 100644
--- a/docs/crash_course/crash_course.rst
+++ b/docs/crash_course/crash_course.rst
@@ -9,7 +9,7 @@ Example code
In a typical script, you load or generate some clips, modify them, combine them, and write the result to a video file.
So let us load a movie of my last holidays, lower the volume, add a title in the center of the video for the ten first seconds, and write the result in a file: ::
- from moviepy.all import *
+ from moviepy.editor import *
# Load myHolidays.mp4 and select the subclip 00:00:50 - 00:00:60
clip = VideoFileClip("myHolidays.mp4").subclip(50,60)
@@ -193,6 +193,7 @@ Much better ! There are already many effects implemented in the modules ``moviep
fx( vfx.speedx, 2).\ # double speed
fx( vfx.colorx, 0.5) # darken (decreases the RGB values)
+For convenience, frequently used methods such as ``resize`` can be called in a simpler way: ``clip.resize(...)`` instead of ``clip.fx( vfx.resize, ...)``
clip.fl
diff --git a/docs/explications.jpeg b/docs/explications.jpeg
new file mode 100644
index 00000000..cd71e587
Binary files /dev/null and b/docs/explications.jpeg differ
diff --git a/docs/index.rst b/docs/index.rst
index fb39f440..913fa5c7 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,10 +1,10 @@
MoviePy
=======
-MoviePy is a Python module for script-based movie editing, which enables basic operations (cuts, concatenations, title insertions) to be done in a few lines. It can also be used for advanced compositing and special effects. Let me put together the clips in my demonstration folder: ::
+MoviePy is a Python module for script-based movie editing, which enables basic operations (cuts, concatenations, title insertions) to be done in a few lines. It can also be used for advanced compositing and special effects. Let me put together the clips in my demonstration folder (you will find the code for most clips in the :ref:`examples`): ::
import os
- from moviepy.all import *
+ from moviepy.editor import *
files = sorted( os.listdir("clips/") )
clips = [ VideoFileClip('clips/%s'%f) for f in files]
video = concatenate(clips, transition = VideoFileClip("logo.avi"))
@@ -22,9 +22,16 @@ MoviePy is a Python module for script-based movie editing, which enables basic o
allowfullscreen="true" width="550" height="450"></embed></object>
</center>
-You will find the code for most clips in the :ref:`examples`.
+How it works
+-------------
-You can do pretty much any effect you want with MoviePy, but it is just a framework, and in most cases you will need to code a little (or find someone who will !) to come to your goal.
+MoviePy uses mainly ``ffmpeg`` for reading/writing multimedia files, and Numpy/Scipy for image and sound manipulations.
+
+.. image:: explications.jpeg
+ :width: 570px
+ :align: center
+
+You can do pretty much any effect you want with MoviePy, but it is just a framework, and in many cases you will need to code a little (or find someone who will !) to come to your goal.
User's Guide
@@ -38,6 +45,8 @@ User's Guide
examples/examples
ref/ref
+Contribute !
+-------------
MoviePy is a (still experimental) open source software written by Zulko_ and released under the MIT licence. Everyone is very welcome to help improve the project, fork it, blog on it, share code for new effects, etc... The more, the merrier !
diff --git a/examples/compo_from_image.py b/examples/compo_from_image.py
index fcbdb313..64bb0a9c 100644
--- a/examples/compo_from_image.py
+++ b/examples/compo_from_image.py
@@ -1,5 +1,5 @@
-from moviepy.all import *
-from moviepy.plugins.segmenting import findObjects
+from moviepy.editor import *
+from moviepy.video.tools.segmenting import findObjects
# Load the image specifying the regions.
im = ImageClip("../../ultracompositing/motif.png")
@@ -19,13 +19,13 @@ clips = [VideoFileClip(n, audio=False).subclip(18,22) for n in
"../../videos/grsm_0005.mov"]]
# fit each clip into its region
-comp_clips = [c.fx(vfx.resize, r.size).\
+comp_clips = [c.resize(r.size).\
set_mask(r.mask).\
set_pos(r.screenpos)
for c,r in zip(clips,regions)]
cc = CompositeVideoClip(comp_clips,im.size)
-cc.fx( vfx.resize, 0.6).to_videofile("../../bigcompo.avi")
+cc.resize(0.6).to_videofile("../../bigcompo.avi")
# Note that this particular composition takes quite a long time of
# rendering (about 20s on my computer for just 4s of video).
diff --git a/examples/example_with_sound.py b/examples/example_with_sound.py
index 12cc0411..2b364fe0 100644
--- a/examples/example_with_sound.py
+++ b/examples/example_with_sound.py
@@ -5,7 +5,7 @@ talking at the same time, because it is actually two scenes of a same
movie put together.
"""
-from moviepy.all import *
+from moviepy.editor import *
from moviepy.video.tools.drawing import color_split
@@ -22,7 +22,7 @@ W,H = main_clip.size
# MAKE THE LEFT CLIP : cut, crop, add a mask
clip_left = main_clip.coreader().subclip(0,duration).\
- fx( vfx.crop, x1=60, x2=60 + 2*W/3)
+ crop( x1=60, x2=60 + 2*W/3)
mask = color_split((2*W/3,H), p1=(W/3,H), p2=(2*W/3,0),
col1=1, col2=0, grad_width=2)
@@ -33,7 +33,7 @@ clip_left.mask = ImageClip(mask, ismask=True)
# MAKE THE RIGHT CLIP : cut, crop, add a mask
clip_right = main_clip.coreader().subclip(21,21+duration).\
- fx( vfx.crop, x1=70, x2=70+2*W/3)
+ crop(x1=70, x2=70+2*W/3)
mask = color_split((2*W/3,H), p1=(2,H), p2=(W/3+2,0),
col1=0, col2=1, grad_width=2)
@@ -44,8 +44,8 @@ clip_right.mask = ImageClip(mask, ismask=True)
# ASSEMBLE AND WRITE THE MOVIE TO A FILE
-cc = CompositeVideoClip([clip_right.set_pos('right').fx(afx.volumex, 0.4),
- clip_left.set_pos('left').fx(afx.volumex, 0.4)],
+cc = CompositeVideoClip([clip_right.set_pos('right').volumex(0.4),
+ clip_left.set_pos('left').volumex(0.4)],
size = (W,H))
#cc.preview()
cc.to_videofile("../../biphone3.avi",fps=24, codec='mpeg4')
diff --git a/examples/headblur.py b/examples/headblur.py
index b5596a77..27963b49 100644
--- a/examples/headblur.py
+++ b/examples/headblur.py
@@ -1,6 +1,6 @@
import pickle
-from moviepy.all import *
+from moviepy.editor import *
from moviepy.video.tools.tracking import manual_tracking, to_fxfy
diff --git a/examples/masked_credits.py b/examples/masked_credits.py
index 069bc8b0..3a1c92c1 100644
--- a/examples/masked_credits.py
+++ b/examples/masked_credits.py
@@ -1,10 +1,10 @@
-from moviepy.all import *
+from moviepy.editor import *
from moviepy.video.tools.credits import credits1
# Load the mountains clip, cut it, slow it down, make it look darker
clip = VideoFileClip('../../videos/badl-0001.mov', audio=False).\
subclip(37,46).\
- fx( vfx.speedx, 0.4).\
+ speedx( 0.4).\
fx( vfx.colorx, 0.7)
# Save the first frame to later make a mask with GIMP (only once)
diff --git a/examples/moving_letters.py b/examples/moving_letters.py
index cc912510..02bfb270 100644
--- a/examples/moving_letters.py
+++ b/examples/moving_letters.py
@@ -1,5 +1,5 @@
import numpy as np
-from moviepy.all import *
+from moviepy.editor import *
from moviepy.video.tools.segmenting import findObjects
# WE CREATE THE TEXT THAT IS GOING TO MOVE, WE CENTER IT.
@@ -10,9 +10,11 @@ txtClip = TextClip('Cool effect',color='white', font="Amiri-Bold",
cvc = CompositeVideoClip( [txtClip.set_pos('center')],
size=screensize, transparent=True)
-# WE DEFINE FOUR WAYS OF MOVING THE LETTERS
+# THE NEXT FOUR FUNCTIONS DEFINE FOUR WAYS OF MOVING THE LETTERS
-rotMatrix = lambda a: np.array( [[np.cos(a),np.sin(a)],
+
+# helper function
+rotMatrix = lambda a: np.array( [[np.cos(a),np.sin(a)],
[-np.sin(a),np.cos(a)]] )
def vortex(screenpos,i,nletters):
@@ -41,7 +43,7 @@ def vortexout(screenpos,i,nletters):
-# WE USE THE PLUGIN TO LOCATE AND SEPARATE EACH LETTER
+# WE USE THE PLUGIN findObjects TO LOCATE AND SEPARATE EACH LETTER
letters = findObjects(cvc) # a list of ImageClips
diff --git a/examples/painting_effect.py b/examples/painting_effect.py
index 2f976584..8bfb2e92 100644
--- a/examples/painting_effect.py
+++ b/examples/painting_effect.py
@@ -1,12 +1,14 @@
""" requires scikit-image installed (for vfx.painting) """
-from moviepy.all import *
+from moviepy.editor import *
# WE TAKE THE SUBCLIPS WHICH ARE 2 SECONDS BEFORE & AFTER THE FREEZE
charade = VideoFileClip("../../videos/charade.mp4")
tfreeze = cvsecs(19,21) # Time of the freeze, 19'21
+# when using several subclips of a same clip, it can be faster
+# to create 'coreaders' of the clip (=other entrance points).
clip_before = charade.coreader().subclip(tfreeze -2,tfreeze)
clip_after = charade.coreader().subclip(tfreeze ,tfreeze +2)
@@ -22,8 +24,8 @@ txt = TextClip('Audrey',font='Amiri-regular',fontsize=35)
painting_txt = CompositeVideoClip([painting,txt.set_pos((10,180))]).\
add_mask().\
set_duration(3).\
- fx( transfx.crossfadein, 0.5).\
- fx( transfx.crossfadeout, 0.5)
+ crossfadein( 0.5).\
+ crossfadeout( 0.5)
# FADEIN/FADEOUT EFFECT ON THE PAINTED IMAGE
@@ -35,4 +37,5 @@ final_clip = concatenate([ clip_before,
painting_fading.set_duration(3),
clip_after])
-final_clip.to_videofile('../../audrey.avi',fps=charade.fps, codec = "mpeg4", audio_bitrate="3000k")
+final_clip.to_videofile('../../audrey.avi',fps=charade.fps,
+ codec = "mpeg4", audio_bitrate="3000k")
diff --git a/examples/soundtrack.py b/examples/soundtrack.py
index d627829b..bcc19068 100644
--- a/examples/soundtrack.py
+++ b/examples/soundtrack.py
@@ -1,5 +1,5 @@
""" A simple test script on how to put a soundtrack to a movie """
-from moviepy.all import *
+from moviepy.editor import *
# We load a movie and replace the sound with some music:
diff --git a/examples/star_worms.py b/examples/star_worms.py
index 72d3e7dc..b97374f5 100644
--- a/examples/star_worms.py
+++ b/examples/star_worms.py
@@ -9,7 +9,7 @@ background made of stars. Slight fading effect on the text.
import numpy as np
from skimage import transform as tf
-from moviepy.all import *
+from moviepy.editor import *
from moviepy.video.tools.drawing import color_gradient
@@ -135,7 +135,7 @@ def annotate(clip,txt,txt_color='white',bg_color=(0,0,255)):
def resizeCenter(clip):
- return clip.fx( vfx.resize, height=h).set_pos('center')
+ return clip.resize( height=h).set_pos('center')
def composeCenter(clip):
diff --git a/examples/the_end.py b/examples/the_end.py
index 2786b50e..0f367b3a 100644
--- a/examples/the_end.py
+++ b/examples/the_end.py
@@ -1,4 +1,4 @@
-from moviepy.all import *
+from moviepy.editor import *
from moviepy.video.tools.drawing import circle
clip = VideoFileClip("../../videos/badl-0006.mov", audio=False).\
diff --git a/examples/ukulele_concerto.py b/examples/ukulele_concerto.py
index 04612f0f..5fe0d2a0 100644
--- a/examples/ukulele_concerto.py
+++ b/examples/ukulele_concerto.py
@@ -1,11 +1,11 @@
-from moviepy.all import *
+from moviepy.editor import *
# UKULELE CLIP, OBTAINED BY CUTTING AND CROPPING
# RAW FOOTAGE
ukulele = VideoFileClip("../../videos/moi_ukulele.MOV", audio=False).\
subclip(60+33, 60+50).\
- fx( vfx.crop, 486, 180, 1196, 570)
+ crop(486, 180, 1196, 570)
w,h = moviesize = ukulele.size
@@ -14,9 +14,9 @@ w,h = moviesize = ukulele.size
piano = (VideoFileClip("../../videos/douceamb.mp4",audio=False).
subclip(30,50).
- fx( vfx.resize, (w/3,h/3)). # one third of the total screen
- fx( vfx.margin, 6,color=(255,255,255)). #white margin
- fx( vfx.margin, bottom=20, right=20, opacity=0). # transparent
+ resize((w/3,h/3)). # one third of the total screen
+ margin( 6,color=(255,255,255)). #white margin
+ margin( bottom=20, right=20, opacity=0). # transparent
set_pos(('right','bottom')) )
diff --git a/moviepy/audio/fx/audio_left_right.py b/moviepy/audio/fx/audio_left_right.py
new file mode 100644
index 00000000..8c8b6804
--- /dev/null
+++ b/moviepy/audio/fx/audio_left_right.py
@@ -0,0 +1,13 @@
+import numpy as np
+
+def audio_left_right(audioclip, left=1, right=1, merge=False):
+ """
+ For a stereo audioclip, this function enables to change the volume
+ of the left and right channel separately (with the factors `left`
+ and `right`)
+ Makes a stereo audio clip in which the volume of left and right
+ is controlable
+ """
+ funleft = (lambda t: left) if np.isscalar(left) else left
+ funright = (lambda t: right) if np.isscalar(right) else right
+
diff --git a/moviepy/decorators.py b/moviepy/decorators.py
index d1d46c8e..262a65c3 100644
--- a/moviepy/decorators.py
+++ b/moviepy/decorators.py
@@ -23,6 +23,15 @@ def apply_to_audio(f, clip, *a, **k):
if hasattr(newclip, 'audio') and (newclip.audio != None):
newclip.audio = f(newclip.audio, *a, **k)
return newclip
+
+
+def add_mask_if_none(f, clip, *a, **k):
+ """ This decorator will apply the function f to the audio of
+ the clip created with f """
+ if clip.mask is None:
+ clip = clip.add_mask()
+ return f(clip, *a, **k)
@decorator.decorator
diff --git a/moviepy/all.py b/moviepy/editor.py
similarity index 58%
rename from moviepy/all.py
rename to moviepy/editor.py
index 8adec3be..76295c66 100644
--- a/moviepy/all.py
+++ b/moviepy/editor.py
@@ -30,3 +30,23 @@ try:
from moviepy.video.io.sliders import sliders
except:
pass
+
+# The next loop transforms many effects into VideoClip methods so that
+# they can be walled with myclip.resize(width=500) instead of
+# myclip.fx( vfx.resize, width= 500)
+for method in ["vfx.crop",
+ "vfx.resize",
+ "vfx.margin",
+ "vfx.fadein",
+ "vfx.fadeout",
+ "vfx.speedx",
+ "afx.volumex",
+ "afx.audio_fadein",
+ "afx.audio_fadeout",
+ "transfx.crossfadein",
+ "transfx.crossfadeout"]:
+ exec("VideoClip.%s = %s"%( method.split('.')[1], method))
+
+VideoClip.crop = vfx.crop
+VideoClip.resize = vfx.resize
+
diff --git a/moviepy/video/VideoClip.py b/moviepy/video/VideoClip.py
index fdd0dfd9..c00cc739 100644
--- a/moviepy/video/VideoClip.py
+++ b/moviepy/video/VideoClip.py
@@ -394,7 +394,7 @@ class VideoClip(Clip):
pos = 'center'
colorclip = ColorClip(size, color)
if col_opacity:
- colorclip = colorclip.add_mask().set_opacity(col_opacity)
+ colorclip = colorclip.set_opacity(col_opacity)
return CompositeVideoClip([colorclip, self.set_pos(pos)],
transparent=(col_opacity != None))
diff --git a/moviepy/video/compositing/transitions.py b/moviepy/video/compositing/transitions.py
index f9979dcb..e9e0158c 100644
--- a/moviepy/video/compositing/transitions.py
+++ b/moviepy/video/compositing/transitions.py
@@ -1,12 +1,13 @@
"""
-Don't abuse transitions ! Here is the current catalogue. These are meant
-to be used with clip.fx
+Here is the current catalogue. These are meant
+to be used with clip.fx. There are available as transfx.crossfadein etc.
+if you load them with ``from moviepy.all import *``
"""
-from moviepy.decorators import requires_duration
-
+from moviepy.decorators import requires_duration, add_mask_if_none
from moviepy.video.fx import fadein, fadeout
+@add_mask_if_none
def crossfadein(clip, duration):
"""
Makes the clip appear progressively, over ``duration`` seconds.
@@ -18,6 +19,7 @@ def crossfadein(clip, duration):
@requires_duration
+@add_mask_if_none
def crossfadeout(clip, duration):
"""
Makes the clip disappear progressively, over ``duration`` seconds.
diff --git a/moviepy/video/fx/crop.py b/moviepy/video/fx/crop.py
index d81911e1..cf95c19e 100644
--- a/moviepy/video/fx/crop.py
+++ b/moviepy/video/fx/crop.py
@@ -1,7 +1,33 @@
-def crop(clip, x1=0, y1=0, x2=None, y2=None):
- if x2 is None:
- x2 = clip.size[0]
- if y2 is None:
- y2 = clip.size[1]
- return clip.fl_image(lambda pic: pic[y1:y2, x1:x2],
- applyto=['mask'])
+def crop(clip, x1=None, y1=None, x2=None, y2=None,
+ width = None, height=None, x_center= None, y_center=None):
+
+
+ if width:
+ if x1 is not None:
+ x2 = x1+width
+ else:
+ x1 = x2-width
+
+ if height:
+ if y1 is not None:
+ y2 = y1+height
+ else:
+ y1 = y2 - height
+
+ if x_center:
+ x1, x2 = x_center - width/2, x_center + width/2
+
+ if y_center:
+ y1, y2 = y_center - height/2, y_center + height/2
+
+ if x1 is None:
+ x1 = 0
+ if y1 is None:
+ y1 = 0
+ if x2 is None:
+ x2 = clip.size[0]
+ if y2 is None:
+ y2 = clip.size[1]
+
+ return clip.fl_image(lambda pic: pic[y1:y2, x1:x2],
+ applyto=['mask'])
diff --git a/moviepy/video/fx/freeze_at_end.py b/moviepy/video/fx/freeze_at_end.py
new file mode 100644
index 00000000..4a0ed1db
--- /dev/null
+++ b/moviepy/video/fx/freeze_at_end.py
@@ -0,0 +1,22 @@
+from moviepy.decorators import requires_duration
+from moviepy.video.VideoClip import ImageClip
+from moviepy.video.compositing.CompositeVideoClip import CompositeVideoClip
+
+
+@requires_duration
+def freeze_at_end(clip, freeze_duration=None, total_duration=None):
+ """
+ Makes the clip freeze on its last frame. With ``duration`` you can
+ specify the duration of the freeze. With ``total_duration`` you can
+ specify the total duration of the clip and the freeze (i.e. the
+ duration of the freeze is automatically calculated). If neither
+ is provided, the freeze will have an infinite length.
+ """
+
+ freezed_clip = ImageClip(clip.get_frame(clip.end))
+ if total_duration:
+ freeze_duration = total_duration - clip.duration
+ if freeze_duration:
+ freezed_clip = freezed_clip.set_duration(freeze_duration)
+
+ return CompositeVideoClip([clip,freezed_clip.set_start(clip.end)])
diff --git a/moviepy/video/fx/freeze_at_start.py b/moviepy/video/fx/freeze_at_start.py
new file mode 100644
index 00000000..4fc34d45
--- /dev/null
+++ b/moviepy/video/fx/freeze_at_start.py
@@ -0,0 +1,22 @@
+from moviepy.decorators import requires_duration
+from moviepy.video.VideoClip import ImageClip
+from moviepy.video.compositing.concatenate import concatenate
+
+
+@requires_duration
+def freeze_at_start(clip, freeze_duration=None, total_duration=None):
+ """
+ Makes the clip freeze on its last frame. With ``duration`` you can
+ specify the duration of the freeze. With ``total_duration`` you can
+ specify the total duration of the clip and the freeze (i.e. the
+ duration of the freeze is automatically calculated). If neither
+ is provided, the freeze will have an infinite length.
+ """
+
+ freezed_clip = ImageClip(clip.get_frame(0))
+ if total_duration:
+ freeze_duration = total_duration - clip.duration
+ if freeze_duration:
+ freezed_clip = freezed_clip.set_duration(freeze_duration)
+
+ return concatenate([freezed_clip,clip])
diff --git a/moviepy/video/fx/margin.py b/moviepy/video/fx/margin.py
index 7384e73d..4a45165d 100644
--- a/moviepy/video/fx/margin.py
+++ b/moviepy/video/fx/margin.py
@@ -1,5 +1,6 @@
import numpy as np
from moviepy.decorators import apply_to_mask
+from moviepy.video.VideoClip import ImageClip
@apply_to_mask
@@ -26,19 +27,31 @@ def margin(clip, mar=None, left=0, right=0, top=0,
if mar != None:
left = right = top = bottom = mar
-
- new_w, new_h = clip.w + left + right, clip.h + top + bottom
- if clip.ismask:
- shape = (new_h, new_w)
- bg = np.tile(opacity, (new_h, new_w)).reshape(shape)
+ def make_bg(w,h):
+ new_w, new_h = w + left + right, h + top + bottom
+ if clip.ismask:
+ shape = (new_h, new_w)
+ bg = np.tile(opacity, (new_h, new_w)).reshape(shape)
+ else:
+ shape = (new_h, new_w, 3)
+ bg = np.tile(color, (new_h, new_w)).reshape(shape)
+ return bg
+
+ if isinstance(clip, ImageClip):
+
+ im = make_bg(clip.w,clip.h)
+ im[top:top + clip.h, left:left + clip.w] = clip.img
+ return clip.fl_image(lambda pic:im)
+
else:
- shape = (new_h, new_w, 3)
- bg = np.tile(color, (new_h, new_w)).reshape(shape)
-
- def fl(pic):
- im = +bg
- im[top:top + clip.h, left:left + clip.w] = pic
- return im
-
- return clip.fl_image(fl)
+
+ def fl(gf, t):
+ pic = gf(t)
+ h,w = pic.shape[:2]
+ im = make_bg(w,h)
+ im[top:top + h, left:left + w] = pic
+ return im
+ return clip.fl(fl)
+
+
diff --git a/moviepy/video/fx/resize.py b/moviepy/video/fx/resize.py
index d4c3a78c..27f6a392 100644
--- a/moviepy/video/fx/resize.py
+++ b/moviepy/video/fx/resize.py
@@ -58,12 +58,12 @@ def resize(clip, newsize=None, height=None, width=None):
else:
return ns
if hasattr(newsize, "__call__"):
- newsize = lambda t : trans_newsize(newsize(t))
+ newsize2 = lambda t : trans_newsize(newsize(t))
if clip.ismask:
fl = lambda gf,t: 1.0*resizer((255 * gf(t)).astype('uint8'),
- newsize(t))/255
+ newsize2(t))/255
else:
- fl = lambda gf,t: resizer(gf(t).astype('uint8'),newsize(t))
+ fl = lambda gf,t: resizer(gf(t).astype('uint8'),newsize2(t))
return clip.fl(fl)
diff --git a/moviepy/video/fx/rotation.py b/moviepy/video/fx/rotation.py
new file mode 100644
index 00000000..77d54d56
--- /dev/null
+++ b/moviepy/video/fx/rotation.py
@@ -0,0 +1,17 @@
+
+
+
+def rotation(clip, angle, apply_to_mask=True, unit='deg'):
+ if unit == 'rad':
+ angle = 360*angle/(2*3.14159)
+ if angle ==90:
+ return clip.fl_image(lambda im : im.T[::-1],
+ applyto='mask' if apply_to_mask else [])
+ elif angle == -90:
+ return clip.fl_image(lambda im : im.T,
+ applyto='mask' if apply_to_mask else [])
+ elif angle == 180:
+ return clip.fl_image(lambda im : im[::-1,::-1],
+ applyto='mask' if apply_to_mask else [])
+ else:
+ raise 'Angle not supported, only 90, -90, 180'
diff --git a/moviepy/video/io/sliders.py b/moviepy/video/io/sliders.py
new file mode 100644
index 00000000..0869554c
--- /dev/null
+++ b/moviepy/video/io/sliders.py
@@ -0,0 +1,83 @@
+import matplotlib.pyplot as plt
+from matplotlib.widgets import Slider, Button
+
+def sliders(f, sliders_properties, wait_for_validation = False):
+ """ A light GUI to manually explore and tune the outputs of
+ a function.
+ slider_properties is a list of dicts (arguments for Slider )
+
+ def volume(x,y,z):
+ return x*y*z
+
+ intervals = [ { 'label' : 'width', 'valmin': 1 , 'valmax': 5 },
+ { 'label' : 'height', 'valmin': 1 , 'valmax': 5 },
+ { 'label' : 'depth', 'valmin': 1 , 'valmax': 5 } ]
+ inputExplorer(volume,intervals)
+ """
+
+ nVars = len(sliders_properties)
+ slider_width = 1.0/nVars
+ print slider_width
+
+ # CREATE THE CANVAS
+
+ figure,ax = plt.subplots(1)
+ figure.canvas.set_window_title( "Inputs for '%s'"%(f.func_name) )
+
+ # choose an appropriate height
+
+ width,height = figure.get_size_inches()
+ height = min(0.5*nVars,8)
+ figure.set_size_inches(width,height,forward = True)
+
+
+ # hide the axis
+ ax.set_frame_on(False)
+ ax.get_xaxis().set_visible(False)
+ ax.get_yaxis().set_visible(False)
+
+
+ # CREATE THE SLIDERS
+
+ sliders = []
+
+ for i, properties in enumerate(sliders_properties):
+
+ ax = plt.axes([0.1 , 0.95-0.9*(i+1)*slider_width,
+ 0.8 , 0.8* slider_width])
+ if not isinstance(properties,dict):
+ properties =dict(zip(['label','valmin', 'valmax', 'valinit'],
+ properties))
+ sliders.append( Slider(ax=ax, **properties) )
+
+
+ # CREATE THE CALLBACK FUNCTIONS
+
+ def on_changed(event) :
+
+ res = f(*(s.val for s in sliders))
+
+ if res is not None:
+
+ print res
+
+ def on_key_press(event):
+
+ if event.key is 'enter':
+
+ on_changed(event)
+
+ figure.canvas.mpl_connect('key_press_event', on_key_press)
+
+ # AUTOMATIC UPDATE ?
+
+ if not wait_for_validation:
+
+ for s in sliders :
+
+ s.on_changed(on_changed)
+
+
+ # DISPLAY THE SLIDERS
+
+ plt.show()
diff --git a/moviepy/video/tools/segmenting.py b/moviepy/video/tools/segmenting.py
index cccbd798..7fdc1ae2 100644
--- a/moviepy/video/tools/segmenting.py
+++ b/moviepy/video/tools/segmenting.py
@@ -1,6 +1,6 @@
import numpy as np
import scipy.ndimage as ndi
-from moviepy.video.ImageClip import ImageClip
+from moviepy.video.VideoClip import ImageClip
def findObjects(clip,rem_thr=500, preview=False):
diff --git a/setup.py b/setup.py
index 18c342a5..1f284eb3 100644
--- a/setup.py
+++ b/setup.py
@@ -6,7 +6,7 @@ ez_setup.use_setuptools()
from setuptools import setup, find_packages
setup(name='moviepy',
- version='0.2.1.6.3',
+ version='0.2.1.6.4',
author='Zulko 2013',
description='Module for script-based video editing',
long_description=open('README.rst').read(),