Python 3 Moviepy Library Script to Increase or Decrease Speed Filter Effect of Video File Full Tutorial For Beginners

Python 3 Moviepy Library Script to Increase or Decrease Speed Filter Effect of Video File Full Tutorial For Beginners

 

Welcome folks today in this post we will be seeing how to increase or decrease the speed of video inside python using the moviepy library. All the full source code of the application is shown below.

 

 

Get Started

 

 

In order to get started you need to install the following library using the pip command as shown below

 

pip install moviepy

 

After installing this library we will apply video effects to the video as shown below

 

Increasing Speed of Video

 

app.py

 

# Import everything needed to edit video clips 
from moviepy.editor import *

# loading video dsa gfg intro video 
clip = VideoFileClip("video.mkv") 

# getting only first 20 seconds 
clip = clip.subclip(0, 20) 

# applying speed effect 
final = clip.fx( vfx.speedx, 2) 

# showing final clip 
final.ipython_display()

 

See also  Python PyAutoGUI TypeWriter Omegle API Message Bot to Send out Unlimited Messages to People in Regular Intervals of Time Full Project For Beginners

Here we are extracting subclip of the original video on which we will be applying the filter so we are extracting the first 20 seconds and increasing the speed of it

 

Decreasing Video Speed

 

app.py

 

# Import everything needed to edit video clips 
from moviepy.editor import *

# loading video dsa gfg intro video 
clip = VideoFileClip("video.mkv") 

# getting only first 20 seconds 
clip = clip.subclip(0, 20) 

# applying speed effect 
final = clip.fx( vfx.speedx, 0.5) 

# showing final clip 
final.ipython_display()

 

See also  Python 3 Tkinter Displaying Multiple Items in Listbox Widget With Scrollbar GUI Desktop App Full Project For Beginners

So here we are passing the value very small such as 0.5. So higher the value means we are increasing the speed and lower the value means we are decreasing the speed of the video

 

Now you can run this app.py script by typing the below command as shown below

 

python app.py

 

Leave a Reply