Skip to content

Video editing with Python

Fix HH:MM:SS format support for 'Clip.with_duration' (#1609)

Álvaro Mondéjar3dc3b4fc9ee5
diff --git a/moviepy/Clip.py b/moviepy/Clip.py
index b50832bc..e664d33c 100644
--- a/moviepy/Clip.py
+++ b/moviepy/Clip.py
@@ -258,7 +258,7 @@ class Clip:
@apply_to_mask
@apply_to_audio
- @convert_parameter_to_seconds(["t"])
+ @convert_parameter_to_seconds(["duration"])
@outplace
def with_duration(self, duration, change_end=True):
"""Returns a copy of the clip, with the ``duration`` attribute set to
diff --git a/tests/test_Clip.py b/tests/test_Clip.py
index 934ce8a4..950463f5 100644
--- a/tests/test_Clip.py
+++ b/tests/test_Clip.py
@@ -104,8 +104,8 @@ def test_clip_with_end(duration, start, end, expected_start, expected_duration):
),
(
(5, None, None, 3, True, 3, 0, 3),
- (5, 1, 6, 3, True, 3, 1, 4), # change end
- (5, 1, 6, 3, False, 3, 3, 6), # change start
+ ("00:00:05", 1, 6, 3, True, 3, 1, 4), # change end
+ ((0, 0, 5), 1, 6, 3, False, 3, 3, 6), # change start
(5, None, None, None, False, ValueError, None, None),
),
)