Get dimensions of a video file

If I understood you correctly, you mean the resolution of a video for example (768×432).

This could be done simply using opencv in python.

import cv2
file_path = "./video.avi"  # change to your own video path
vid = cv2.VideoCapture(file_path)
height = vid.get(cv2.CAP_PROP_FRAME_HEIGHT)
width = vid.get(cv2.CAP_PROP_FRAME_WIDTH)

Leave a Comment