Skip to content

Video editing with Python

Remove 'make_loopable' from transitions (#1477)

Álvaro Mondéjar22037d9572c5
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ccedb004..b8d9d963 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `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)
+- `make_loopable` transition must be used as FX [\#1477](https://github.com/Zulko/moviepy/pull/1477)
### 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/moviepy/video/compositing/transitions.py b/moviepy/video/compositing/transitions.py
index da7901e1..bd3e6bf7 100644
--- a/moviepy/video/compositing/transitions.py
+++ b/moviepy/video/compositing/transitions.py
@@ -4,12 +4,11 @@ to be used with clip.fx. There are available as transfx.crossfadein etc.
"""
from moviepy.decorators import add_mask_if_none, requires_duration
-from moviepy.video.compositing.CompositeVideoClip import CompositeVideoClip
from moviepy.video.fx.fadein import fadein
from moviepy.video.fx.fadeout import fadeout
-__all__ = ["crossfadein", "crossfadeout", "slide_in", "slide_out", "make_loopable"]
+__all__ = ["crossfadein", "crossfadeout", "slide_in", "slide_out"]
@requires_duration
@@ -119,14 +118,3 @@ def slide_out(clip, duration, side):
}
return clip.with_position(pos_dict[side])
-
-
-@requires_duration
-def make_loopable(clip, overlap_duration):
- """Makes the clip fade in progressively at its own end, this way
- it can be looped indefinitely. ``overlap_duration`` is the duration in seconds
- of the fade-in."""
- clip2 = clip.fx(crossfadein, overlap_duration).with_start(
- clip.duration - overlap_duration
- )
- return CompositeVideoClip([clip, clip2]).subclip(overlap_duration, clip.duration)
diff --git a/moviepy/video/fx/make_loopable.py b/moviepy/video/fx/make_loopable.py
index 2b1b3ad4..f06065e6 100644
--- a/moviepy/video/fx/make_loopable.py
+++ b/moviepy/video/fx/make_loopable.py
@@ -4,12 +4,17 @@ from moviepy.video.compositing.CompositeVideoClip import CompositeVideoClip
@requires_duration
-def make_loopable(clip, overlap_time):
+def make_loopable(clip, overlap_duration):
+ """Makes the clip fade in progressively at its own end, this way it can be
+ looped indefinitely.
+
+ Parameters
+ ----------
+
+ overlap_duration : float
+ Duration of the fade-in (in seconds).
"""
- Makes the clip fade in progressively at its own end, this way
- it can be looped indefinitely. ``overlap_time`` is the duration in seconds
- of the fade-in."""
- clip2 = clip.fx(transfx.crossfadein, overlap_time).with_start(
- clip.duration - overlap_time
+ clip2 = clip.fx(transfx.crossfadein, overlap_duration).with_start(
+ clip.duration - overlap_duration
)
- return CompositeVideoClip([clip, clip2]).subclip(overlap_time, clip.duration)
+ return CompositeVideoClip([clip, clip2]).subclip(overlap_duration, clip.duration)