Video editing with Python
Rename 'speedx' FX by 'multiply_speed' (#1478)
Álvaro Mondéjarb57640312e73
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex bac2832d..ccedb004 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- Renamed `cols_widths` argument of `clips_array` function by `cols_heights` [\#1465](https://github.com/Zulko/moviepy/pull/1465)- `video_nframes` attribute of dictionary returned from `ffmpeg_parse_infos` renamed to `video_n_frames` [\#1471](https://github.com/Zulko/moviepy/pull/1471)- Renamed `colorx` FX by `multiply_color` [\#1475](https://github.com/Zulko/moviepy/pull/1475)+- Renamed `speedx` FX by `multiply_speed` [\#1478](https://github.com/Zulko/moviepy/pull/1478)### Deprecated <!-- for soon-to-be removed features -->- `moviepy.video.fx.all` and `moviepy.audio.fx.all`. Use the fx method directly from the clip instance or import the fx function from `moviepy.video.fx` and `moviepy.audio.fx`. [\#1105](https://github.com/Zulko/moviepy/pull/1105)diff --git a/docs/getting_started/effects.rst b/docs/getting_started/effects.rstindex bc844b73..54365849 100644--- a/docs/getting_started/effects.rst+++ b/docs/getting_started/effects.rst@@ -52,7 +52,7 @@ Much better! There are already many effects implemented in the modules ``moviepyfrom moviepy import *clip = (VideoFileClip("myvideo.avi").fx( vfx.resize, width=460) # resize (keep aspect ratio)- .fx( vfx.speedx, 2) # double the speed+ .fx( vfx.multiply_speed, 2) # double the speed.fx( vfx.multiply_color, 0.5)) # darken the pictureFor convenience, fx methods such as ``resize`` can be called in a simpler way: ``clip.resize(...)`` instead of ``clip.fx( vfx.resize, ...)``diff --git a/docs/ref/videofx.rst b/docs/ref/videofx.rstindex 0f484fca..2dbf4885 100644--- a/docs/ref/videofx.rst+++ b/docs/ref/videofx.rst@@ -55,11 +55,11 @@ the module ``video.fx`` is loaded as ``vfx`` and you can use ``vfx.multiply_colomirror_xmirror_ymultiply_color+ multiply_speedpaintingresizerotatescroll- speedxsupersampletime_mirrortime_symmetrizediff --git a/docs/ref/videofx/moviepy.video.fx.all.colorx.rst b/docs/ref/videofx/moviepy.video.fx.all.multiply_color.rstsimilarity index 100%rename from docs/ref/videofx/moviepy.video.fx.all.colorx.rstrename to docs/ref/videofx/moviepy.video.fx.all.multiply_color.rstdiff --git a/docs/ref/videofx/moviepy.video.fx.all.multiply_speed.rst b/docs/ref/videofx/moviepy.video.fx.all.multiply_speed.rstnew file mode 100644index 00000000..559e6098--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.all.multiply_speed.rst@@ -0,0 +1,6 @@+moviepy.video.fx.all.multiply_speed+===================================++.. currentmodule:: moviepy.video.fx.all++.. autofunction:: multiply_speed\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.all.speedx.rst b/docs/ref/videofx/moviepy.video.fx.all.speedx.rstdeleted file mode 100644index 6710d0fe..00000000--- a/docs/ref/videofx/moviepy.video.fx.all.speedx.rst+++ /dev/null@@ -1,6 +0,0 @@-moviepy.video.fx.all.speedx-===========================--.. currentmodule:: moviepy.video.fx.all--.. autofunction:: speedx\ No newline at end of filediff --git a/moviepy/Clip.py b/moviepy/Clip.pyindex 223bfcb0..24292bb9 100644--- a/moviepy/Clip.py+++ b/moviepy/Clip.py@@ -297,9 +297,9 @@ class Clip:halved in this mode, the duration will be doubled."""if change_duration:- from moviepy.video.fx.speedx import speedx+ from moviepy.video.fx.multiply_speed import multiply_speed- newclip = speedx(self, fps / self.fps)+ newclip = multiply_speed(self, fps / self.fps)else:newclip = self.copy()diff --git a/moviepy/video/VideoClip.py b/moviepy/video/VideoClip.pyindex 71a1283c..4cd14df8 100644--- a/moviepy/video/VideoClip.py+++ b/moviepy/video/VideoClip.py@@ -523,7 +523,7 @@ class VideoClip(Clip):slower than the clip you will use ::>>> # slow down clip 50% and make it a gif- >>> myClip.speedx(0.5).to_gif('myClip.gif')+ >>> myClip.multiply_speed(0.5).to_gif('myClip.gif')"""# A little sketchy at the moment, maybe move all that in write_gif,@@ -589,7 +589,7 @@ class VideoClip(Clip):>>> # The scene between times t=3s and t=6s in ``clip`` will be>>> # be played twice slower in ``new_clip``- >>> new_clip = clip.subapply(lambda c:c.speedx(0.5) , 3,6)+ >>> new_clip = clip.subapply(lambda c:c.multiply_speed(0.5) , 3,6)"""left = None if (start_time == 0) else self.subclip(0, start_time)diff --git a/moviepy/video/fx/__init__.py b/moviepy/video/fx/__init__.pyindex 2c6b318b..d1f56ce3 100644--- a/moviepy/video/fx/__init__.py+++ b/moviepy/video/fx/__init__.py@@ -22,11 +22,11 @@ from moviepy.video.fx.mask_or import mask_orfrom moviepy.video.fx.mirror_x import mirror_xfrom moviepy.video.fx.mirror_y import mirror_yfrom moviepy.video.fx.multiply_color import multiply_color+from moviepy.video.fx.multiply_speed import multiply_speedfrom moviepy.video.fx.painting import paintingfrom moviepy.video.fx.resize import resizefrom moviepy.video.fx.rotate import rotatefrom moviepy.video.fx.scroll import scroll-from moviepy.video.fx.speedx import speedxfrom moviepy.video.fx.supersample import supersamplefrom moviepy.video.fx.time_mirror import time_mirrorfrom moviepy.video.fx.time_symmetrize import time_symmetrize@@ -55,11 +55,11 @@ __all__ = ("mirror_x","mirror_y","multiply_color",+ "multiply_speed","painting","resize","rotate","scroll",- "speedx","supersample","time_mirror","time_symmetrize",diff --git a/moviepy/video/fx/speedx.py b/moviepy/video/fx/multiply_speed.pysimilarity index 90%rename from moviepy/video/fx/speedx.pyrename to moviepy/video/fx/multiply_speed.pyindex a7446054..ade4894e 100644--- a/moviepy/video/fx/speedx.py+++ b/moviepy/video/fx/multiply_speed.py@@ -1,4 +1,4 @@-def speedx(clip, factor=None, final_duration=None):+def multiply_speed(clip, factor=None, final_duration=None):"""Returns a clip playing the current clip but at a speed multipliedby ``factor``. Instead of factor one can indicate the desireddiff --git a/moviepy/video/io/gif_writers.py b/moviepy/video/io/gif_writers.pyindex c217e429..097a10b7 100644--- a/moviepy/video/io/gif_writers.py+++ b/moviepy/video/io/gif_writers.py@@ -195,7 +195,7 @@ def write_gif(slower than the clip you will use ::>>> # slow down clip 50% and make it a gif- >>> myClip.speedx(0.5).write_gif('myClip.gif')+ >>> myClip.multiply_speed(0.5).write_gif('myClip.gif')"""diff --git a/tests/test_VideoClip.py b/tests/test_VideoClip.pyindex 954361c1..b4ed9acd 100644--- a/tests/test_VideoClip.py+++ b/tests/test_VideoClip.py@@ -8,7 +8,7 @@ from moviepy.audio.AudioClip import AudioClipfrom moviepy.audio.io.AudioFileClip import AudioFileClipfrom moviepy.utils import close_all_clipsfrom moviepy.video.compositing.CompositeVideoClip import CompositeVideoClip-from moviepy.video.fx.speedx import speedx+from moviepy.video.fx.multiply_speed import multiply_speedfrom moviepy.video.io.VideoFileClip import VideoFileClipfrom moviepy.video.VideoClip import BitmapClip, ColorClip, VideoClip@@ -166,7 +166,7 @@ def test_write_gif_ImageMagick_tmpfiles_pixel_format():def test_subfx():clip = VideoFileClip("media/big_buck_bunny_0_30.webm").subclip(0, 1)- transform = lambda c: speedx(c, 0.5)+ transform = lambda c: multiply_speed(c, 0.5)new_clip = clip.subfx(transform, 0.5, 0.8)location = os.path.join(TMP_DIR, "subfx.mp4")new_clip.write_videofile(location)diff --git a/tests/test_fx.py b/tests/test_fx.pyindex 25977c72..5779192f 100644--- a/tests/test_fx.py+++ b/tests/test_fx.py@@ -23,9 +23,9 @@ from moviepy.video.fx import (mirror_x,mirror_y,multiply_color,+ multiply_speed,resize,rotate,- speedx,time_mirror,time_symmetrize,)@@ -532,22 +532,22 @@ def test_scroll():pass-def test_speedx():+def test_multiply_speed():clip = BitmapClip([["A"], ["B"], ["C"], ["D"]], fps=1)- clip1 = speedx(clip, 0.5) # 1/2x speed+ clip1 = multiply_speed(clip, 0.5) # 1/2x speedtarget1 = BitmapClip([["A"], ["A"], ["B"], ["B"], ["C"], ["C"], ["D"], ["D"]], fps=1)assert clip1 == target1- clip2 = speedx(clip, final_duration=8) # 1/2x speed+ clip2 = multiply_speed(clip, final_duration=8) # 1/2x speedtarget2 = BitmapClip([["A"], ["A"], ["B"], ["B"], ["C"], ["C"], ["D"], ["D"]], fps=1)assert clip2 == target2- clip3 = speedx(clip, final_duration=12) # 1/2x speed+ clip3 = multiply_speed(clip, final_duration=12) # 1/2x speedtarget3 = BitmapClip([["A"],@@ -567,15 +567,15 @@ def test_speedx():)assert clip3 == target3- clip4 = speedx(clip, 2) # 2x speed+ clip4 = multiply_speed(clip, 2) # 2x speedtarget4 = BitmapClip([["A"], ["C"]], fps=1)assert clip4 == target4- clip5 = speedx(clip, final_duration=2) # 2x speed+ clip5 = multiply_speed(clip, final_duration=2) # 2x speedtarget5 = BitmapClip([["A"], ["C"]], fps=1)assert clip5 == target5- clip6 = speedx(clip, 4) # 4x speed+ clip6 = multiply_speed(clip, 4) # 4x speedtarget6 = BitmapClip([["A"]], fps=1)assert (clip6 == target6