import cv2
def get_fps(path_vid):
"""
This function return the recorded FPS of the vide.
:param path_vid: The path of the vide
:return: The video file's FPS
"""
cap = cv2.VideoCapture(path_vid)
fps = cap.get(cv2.CAP_PROP_FPS)
cap.release()
cv2.destroyAllWindows()
return fps
def play_vid(path_vid):
"""
This function plays the imported vide based on the path.
:param path_vid: The path of the vide
:return: None
"""
cap = cv2.VideoCapture(path_vid)
while cap.isOpened():
ret, frame = cap.read()
color = cv2.cvtColor(frame, cv2.IMREAD_COLOR)
cv2.imshow('frame', color)
if cv2.waitKey(33) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
if __name__=='__main__':
a=get_fps('22.mp4')
print(a)
# play_vid('./1.mp4')