moviepy.video.fx.AccelDecel#

class moviepy.video.fx.AccelDecel.AccelDecel(new_duration: float = None, abruptness: float = 1.0, soonness: float = 1.0)[source]#

Accelerates and decelerates a clip, useful for GIF making.

Parameters:
  • new_duration (float) -- Duration for the new transformed clip. If None, will be that of the current clip.

  • abruptness (float) --

    Slope shape in the acceleration-deceleration function. It will depend on the value of the parameter:

    • -1 < abruptness < 0: speed up, down, up.

    • abruptness == 0: no effect.

    • abruptness > 0: speed down, up, down.

  • soonness (float) -- For positive abruptness, determines how soon the transformation occurs. Should be a positive number.

Raises:

ValueError -- When sooness argument is lower than 0.

Examples

The following graphs show functions generated by different combinations of arguments, where the value of the slopes represents the speed of the videos generated, being the linear function (in red) a combination that does not produce any transformation.

acced_decel FX parameters combinations
apply(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.