Skip to content

Commit

Permalink
Fix issue Zulko#2269 with PR Zulko#2262, thanks to @Implosiv3
Browse files Browse the repository at this point in the history
  • Loading branch information
osaajani committed Jan 5, 2025
1 parent 6528bcf commit d7d0301
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion moviepy/video/VideoClip.py
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ class ColorClip(ImageClip):
----------
size
Size (width, height) in pixels of the clip.
Size tuple (width, height) in pixels of the clip.
color
If argument ``is_mask`` is False, ``color`` indicates
Expand Down
2 changes: 1 addition & 1 deletion moviepy/video/compositing/CompositeVideoClip.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def frame_function(t):
return clips[i].get_frame(t - timings[i])

def get_mask(clip):
mask = clip.mask or ColorClip([1, 1], color=1, is_mask=True)
mask = clip.mask or ColorClip(clip.size, color=1, is_mask=True)
if mask.duration is None:
mask.duration = clip.duration
return mask
Expand Down
8 changes: 8 additions & 0 deletions tests/test_compositing.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,5 +293,13 @@ def test_slide_out():
assert n_reds == n_reds_expected


def test_concatenate_with_masks(util):
video_without_mask = ColorClip(size=(10, 10), color=(255, 0, 0)).with_duration(1).with_fps(1)
video_with_mask = ColorClip(size=(5, 5), color=(0, 255, 0)).with_duration(1).with_fps(1).with_mask()

output = os.path.join(util.TMP_DIR, "test_concatenate_with_masks.mp4")
concatenate_videoclips([video_without_mask, video_with_mask]).write_videofile(output)


if __name__ == "__main__":
pytest.main()

0 comments on commit d7d0301

Please sign in to comment.