moviepy.video.fx.Margin#

class moviepy.video.fx.Margin.Margin(margin_size: int = None, left: int = 0, right: int = 0, top: int = 0, bottom: int = 0, color: tuple = (0, 0, 0), opacity: float = 1.0)[source]#

Draws an external margin all around the frame.

Parameters:
  • margin_size (int, optional) -- If not None, then the new clip has a margin size of size margin_size in pixels on the left, right, top, and bottom.

  • left (int, optional) -- If margin_size=None, margin size for the new clip in left direction.

  • right (int, optional) -- If margin_size=None, margin size for the new clip in right direction.

  • top (int, optional) -- If margin_size=None, margin size for the new clip in top direction.

  • bottom (int, optional) -- If margin_size=None, margin size for the new clip in bottom direction.

  • color (tuple, optional) -- Color of the margin.

  • opacity (float, optional) -- Opacity of the margin. Setting this value to 0 yields transparent margins.

add_margin(clip: Clip)[source]#

Add margins to the clip.

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.