moviepy.video.fx.MaskColor#

class moviepy.video.fx.MaskColor.MaskColor(color: tuple = (0, 0, 0), threshold: float = 0, stiffness: float = 1)[source]#

Returns a new clip with a mask for transparency where the original clip is of the given color.

You can also have a "progressive" mask by specifying a non-null distance threshold threshold. In this case, if the distance between a pixel and the given color is d, the transparency will be

d**stiffness / (threshold**stiffness + d**stiffness)

which is 1 when d>>threshold and 0 for d<<threshold, the stiffness of the effect being parametrized by stiffness

apply(clip: Clip) Clip[source]#

Apply the effect to the clip.

copy()#

Return a shallow copy of an Effect.

You must always copy an Effect before applying, because some of them will modify their own attributes when applied. For example, setting a previously unset property by using target clip property.

If we was to use the original effect, calling the same effect multiple times could lead to different properties, and different results for equivalent clips.

By using copy, we ensure we can use the same effect object multiple times while maintaining the same behavior/result.

In a way, copy makes the effect himself being kind of idempotent.