Python Get Video Resolution with MoviePy – Python Tutorial

By | February 3, 2022

In order to resize a video, we should know the resolution of a video. In this tutorial, we will introduce how to use python moviepy library to get it.

Import python moviepy

We can import python moviepy library as follows:

from moviepy.editor import *

Then, we can use it to get a video resolution.

Open a video and get its resolution

For example:

clip = VideoFileClip(r"test.mp4") 
value = clip.size
  
# printing size
print("Clip Size ", end = " : ")
print(value)

In this code, we will use clip.size to show a video frame resolution.

Run this code, we will get:

Clip Size  : [480, 360]

It means the width = 480, height = 360

The aspect ratio is 4:3

Python Get Video Resolution with MoviePy – Python Tutorial

Moreover, if you wan to know the duration of a video, you can read:

Best Practice to Python Get Video Duration with MoviePy – Python Tutorial

One thought on “Python Get Video Resolution with MoviePy – Python Tutorial

Leave a Reply