Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zulko committed Nov 23, 2024
1 parent 304fc50 commit 221d0c6
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions moviepy/video/VideoClip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand All @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 221d0c6

Please sign in to comment.