Skip to content

Video editing with Python

added experimental side-in/out transitions

Zulkodb159214242a
diff --git a/moviepy/video/VideoClip.py b/moviepy/video/VideoClip.py
index 5140c85d..bc55f786 100644
--- a/moviepy/video/VideoClip.py
+++ b/moviepy/video/VideoClip.py
@@ -360,8 +360,10 @@ class VideoClip(Clip):
"""
- if verbose:
- print( "MoviePy: Writing frames %s."%(nameformat))
+ def verbose_print(s):
+ if verbose: sys_write_flush(s)
+
+ verbose_print("MoviePy: Writing frames %s."%(nameformat))
if fps is None:
fps = self.fps
@@ -375,8 +377,7 @@ class VideoClip(Clip):
filenames.append(name)
self.save_frame(name, t, savemask=True)
- if verbose:
- print( "MoviePy: Done writing frames %s."%(nameformat))
+ verbose_print("MoviePy: Done writing frames %s."%(nameformat))
return filenames
@@ -436,20 +437,12 @@ class VideoClip(Clip):
fileName, fileExtension = os.path.splitext(filename)
tt = np.arange(0,self.duration, 1.0/fps)
- tempfiles = []
-
+
verbose_print("\nMoviePy: building GIF file %s\n"%filename
+40*"-"+"\n")
-
verbose_print("Generating GIF frames.\n")
-
- total = int(self.duration/fps)+1
- for i, t in tqdm(enumerate(tt), total=total):
-
- name = "%s_GIFTEMP%04d.png"%(fileName, i+1)
- tempfiles.append(name)
- self.save_frame(name, t, savemask=True)
-
+ tempfiles = self.to_images_sequence( fileName+"_GIFTEMP%04d.png",
+ fps=fps, verbose=verbose)
verbose_print("Done generating GIF frames.\n")
delay = int(100.0/fps)
@@ -464,7 +457,7 @@ class VideoClip(Clip):
"-coalesce",
"-fuzz", "%02d"%fuzz + "%",
"-layers", "%s"%opt,
- "%s"%filename]
+ filename]
elif program == "ffmpeg":
diff --git a/moviepy/video/compositing/transitions.py b/moviepy/video/compositing/transitions.py
index dc674bfe..d7fad86d 100644
--- a/moviepy/video/compositing/transitions.py
+++ b/moviepy/video/compositing/transitions.py
@@ -36,8 +36,7 @@ def slide_in(clip, duration, side):
""" Makes the clip arrive from one side of the screen.
Only works when the clip is included in a CompositeVideoClip,
- and if the clip has the same size as the clip it follows / the
- clip it is composed with.
+ and if the clip has the same size as the whole composition.
Parameters
===========
@@ -77,8 +76,7 @@ def slide_out(clip, duration, side):
""" Makes the clip go away by one side of the screen.
Only works when the clip is included in a CompositeVideoClip,
- and if the clip has the same size as the clip it follows / the
- clip it is composed with.
+ and if the clip has the same size as the whole composition.
Parameters
===========