Welcome folks today in this blog post we will be using the moviepy
library to rotate the input
video file at different angles in command line. All the full source code of the application is shown below.
Get Started
First of all we need to install the below moviepy
library using the pip
command as shown below
pip install moviepy
In order to get started you need to make an app.py
file and copy paste the following code
app.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# Import everything needed to edit video clips from moviepy.editor import * # loading video dsa gfg intro video clip = VideoFileClip("dsa_geek.webm") # getting subclip as video is large clip = clip.subclip(55, 65) # rotating clip by 45 degree clip = clip.rotate(45) # showing clip clip.ipython_display(width = 480) |
As you can see we are importing the moviepy
library at the very top and then we are only taking the first 5
seconds of the input video using the subclip()
method and then we are rotating the input video
file at an angle of 45 degree using the rotate()
method.