Skip to content

Video editing with Python

Merge branches, fixed to_gif

Zulko0a2e3bb17a7a
diff --cc moviepy/video/VideoClip.py
index bc55f786,5b0f02c4..2737d717
--- a/moviepy/video/VideoClip.py
+++ b/moviepy/video/VideoClip.py
@@@ -437,13 -440,21 +440,22 @@@ class VideoClip(Clip)
fileName, fileExtension = os.path.splitext(filename)
tt = np.arange(0,self.duration, 1.0/fps)
-
- verbose_print("\nMoviePy: building GIF file %s\n"%filename
++
+ tempfiles = []
+
+ verbose_print(verbose, "\nMoviePy: building GIF file %s\n"%filename
+40*"-"+"\n")
- verbose_print("Generating GIF frames.\n")
- tempfiles = self.to_images_sequence( fileName+"_GIFTEMP%04d.png",
- fps=fps, verbose=verbose)
- verbose_print("Done generating GIF frames.\n")
+
+ verbose_print(verbose, "Generating GIF frames.\n")
+
+ total = int(self.duration*fps)+1
+ for i, t in tqdm(enumerate(tt), total=total):
+
- name = "%s_GIFTEMP%04d.bmp"%(fileName, i+1)
++ name = "%s_GIFTEMP%04d.png"%(fileName, i+1)
+ tempfiles.append(name)
+ self.save_frame(name, t, savemask=True)
+
+ verbose_print(verbose, "Done generating GIF frames.\n")
delay = int(100.0/fps)
@@@ -944,6 -1076,19 +1077,19 @@@ class ImageClip(VideoClip)
setattr(self, attr, new_a)
+ ###
+ #
+ # The old functions to_videofile, to_gif, to_images sequences have been
+ # replaced by the more explicite write_videofile, write_gif, etc.
+
+ VideoClip.to_videofile = deprecated_version_of(VideoClip.write_videofile,
+ 'to_videofile')
-VideoClip.to_gif = deprecated_version_of(VideoClip.write_videofile, 'to_gif')
-VideoClip.to_images_sequence = deprecated_version_of(VideoClip.write_videofile,
++VideoClip.to_gif = deprecated_version_of(VideoClip.write_gif, 'to_gif')
++VideoClip.to_images_sequence = deprecated_version_of(VideoClip.write_images_sequence,
+ 'to_images_sequence')
+
+ ###
+
class ColorClip(ImageClip):
""" An ImageClip showing just one color.