pythonvideomoviepy

Python MoviePy Can't Speed Up Video


Why am I unable to speed up videos with MoviePy? There are two versions MultiplySpeed and speedx, but I couldn't get either working. When I use MutiplySpeed below, I receive the error:

Exception has occurred: 
AttributeError 'MultiplySpeed' object has no attribute 'write_videofile'. 
from moviepy import *
import moviepy.video.fx as vfx
from moviepy.video.fx import MultiplySpeed


# Load the video
clip = VideoFileClip(r"xxx.mp4")
clip = MultiplySpeed(2)
clip.write_videofile("output_fast.mp4", codec="libx264")

Solution

  • Based on documentation you have to apply() it on clip

    clip = MultiplySpeed(2).apply(clip)
    

    Based on source code you may also use with_effects() on clip

    clip = clip.with_effects([MultiplySpeed(2)])