moviepy.audio.fx.MultiplyVolume#
- class moviepy.audio.fx.MultiplyVolume.MultiplyVolume(factor: float, start_time: float | None = None, end_time: float | None = None)[source]#
Returns a clip with audio volume multiplied by the value factor. Can be applied to both audio and video clips.
- Parameters:
factor (float) – Volume multiplication factor.
start_time (float, optional) – Time from the beginning of the clip until the volume transformation begins to take effect, in seconds. By default at the beginning.
end_time (float, optional) – Time from the beginning of the clip until the volume transformation ends to take effect, in seconds. By default at the end.
Examples
from moviepy import AudioFileClip music = AudioFileClip("music.ogg") # doubles audio volume doubled_audio_clip = music.with_effects([afx.MultiplyVolume(2)]) # halves audio volume half_audio_clip = music.with_effects([afx.MultiplyVolume(0.5)]) # silences clip during one second at third effect = afx.MultiplyVolume(0, start_time=2, end_time=3) silenced_clip = clip.with_effects([effect])
- 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.