From 221d0c6635c886ca5f6b77f385b01358f4c57e79 Mon Sep 17 00:00:00 2001 From: Zulko Date: Sat, 23 Nov 2024 13:42:24 -0500 Subject: [PATCH] test fixes --- moviepy/video/VideoClip.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/moviepy/video/VideoClip.py b/moviepy/video/VideoClip.py index dea26dc41..89f53bd45 100644 --- a/moviepy/video/VideoClip.py +++ b/moviepy/video/VideoClip.py @@ -8,7 +8,7 @@ import os import threading from numbers import Real -from typing import TYPE_CHECKING, List, Union +from typing import TYPE_CHECKING, List, Union, Callable import numpy as np import proglog @@ -771,7 +771,7 @@ def blit_on(self, picture, t): pos = map(int, pos) return blit(im_img, picture, pos, mask=im_mask) - def with_background_color(self, size=None, color=(0, 0, 0), pos=None, col_opacity=None): + def with_background_color(self, size=None, color=(0, 0, 0), pos=None, opacity=None): """Place the clip on a colored background. Returns a clip made of the current clip overlaid on a color @@ -802,10 +802,10 @@ def with_background_color(self, size=None, color=(0, 0, 0), pos=None, col_opacit if pos is None: pos = "center" - if col_opacity is not None: + if opacity is not None: colorclip = ColorClip( size, color=color, duration=self.duration - ).with_opacity(col_opacity) + ).with_opacity(opacity) result = CompositeVideoClip([colorclip, self.with_position(pos)]) else: result = CompositeVideoClip( @@ -825,13 +825,13 @@ def with_background_color(self, size=None, color=(0, 0, 0), pos=None, col_opacit return result @outplace - def with_updated_frame_function(self, mf): + def with_updated_frame_function(self, frame_function: Callable[[float], np.ndarray]): """Change the clip's ``get_frame``. Returns a copy of the VideoClip instance, with the frame_function attribute set to `mf`. """ - self.frame_function = mf + self.frame_function = frame_function self.size = self.get_frame(0).shape[:2][::-1] @outplace @@ -853,7 +853,6 @@ def with_mask(self, mask: Union["VideoClip", str] = "auto"): if mask == "auto": if self.has_constant_size: mask = ColorClip(self.size, 1.0, is_mask=True) - return self.with_mask(mask.with_duration(self.duration)) else: def frame_function(t): return np.ones(self.get_frame(t).shape[:2], dtype=float)