Video editing with Python
Updates loop.py for fix and adds new tests using BitmapClip (#1373)
ParikhNand073311db6095
diff --git a/moviepy/video/fx/loop.py b/moviepy/video/fx/loop.pyindex 4488165f..b05c5e4f 100644--- a/moviepy/video/fx/loop.py+++ b/moviepy/video/fx/loop.py@@ -2,8 +2,6 @@ from moviepy.decorators import apply_to_audio, apply_to_mask, requires_duration@requires_duration-@apply_to_mask-@apply_to_audiodef loop(clip, n=None, duration=None):"""Returns a clip that plays the current clip in an infinite loop.@@ -19,7 +17,9 @@ def loop(clip, n=None, duration=None):Total duration of the clip. Can be specified instead of n."""previous_duration = clip.duration- clip = clip.time_transform(lambda t: t % previous_duration)+ clip = clip.time_transform(+ lambda t: t % previous_duration, apply_to=["mask", "audio"]+ )if n:duration = n * previous_durationif duration:diff --git a/tests/test_fx.py b/tests/test_fx.pyindex 44edebd2..80cf4bec 100644--- a/tests/test_fx.py+++ b/tests/test_fx.py@@ -220,13 +220,13 @@ def test_loop():clip1 = loop(clip).with_duration(3) # infinite loopingclip1.write_videofile(os.path.join(TMP_DIR, "loop1.webm"))- return # Still buggy. TODO fix- # clip2 = loop(clip, duration=10) # loop for 10 seconds- # clip2.write_videofile(os.path.join(TMP_DIR, "loop2.webm"))+ clip2 = loop(clip, duration=10) # loop for 10 seconds+ clip2.write_videofile(os.path.join(TMP_DIR, "loop2.webm"))- # clip3 = loop(clip, n=3) # loop 3 times- # clip3.write_videofile(os.path.join(TMP_DIR, "loop3.webm"))- # close_all_clips(objects=locals())+ clip3 = loop(clip, n=3) # loop 3 times+ clip3.write_videofile(os.path.join(TMP_DIR, "loop3.webm"))++ close_all_clips(objects=locals())def test_lum_contrast():