#Python 🐍 – change video speed in a more complex scenario 🎦 using moviepy

Buy Me A Coffee

Hi !

Today I’ll share another cool sample using moviepy.

This one is easy and based on previous posts:

  • Open video and resize to 460
  • Open video, resize to 460 and speed to x4
  • Stack both videos
  • Export to Gif

The code is super simple

from moviepy.editor import VideoFileClip, clips_array, vfx
# open video and resize to 460
clip1 = VideoFileClip("cat1.mp4").subclip(1,5).resize(width=460)
# open video, resize to 460 and speeed to x4
clip2 = VideoFileClip("cat1.mp4").subclip(1,5).resize(width=460).speedx(4)
# final
final_clip = clips_array([[clip1, clip2]])
final_clip.write_gif("speeddemo.gif")

Super, easy. It and the output is a 2MB gif file.

Source video, the full version is here.

Happy coding!

Greetings

El Bruno



¿Con ganas de ponerte al día?

En Lemoncode te ofrecemos formación online impartida por profesionales que se baten el cobre en consultoría:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.