I have a video that was recorded at 120 fps. When I look at the video properties in Windows, it is confirmed to be 120 fps.

enter image description here

And also in VLC:

enter image description here

However, when I use either moviepy or cv2 in Python, I get the incorrect frame rate of 25 fps.

import cv2
from moviepy.editor import *


def main():
    # Define file name
    video_name = r'C:\Users\npires.OMG\OneDrive - OMG PLC\Work Projects\Convert AVI to MP4 H264\Test\Test\Walk ' \
                 r'01.2117813.20210614134127.avi'

# import the video into Python
video_data_cv2 = cv2.VideoCapture(video_name)
video_data_moviepy = VideoFileClip(video_name)

# get the video frame rate
fps_moviepy = video_data_moviepy.fps
fps_cv2 = video_data_cv2.get(cv2.CAP_PROP_FPS)

I get a frame rate of 25 FPS.

enter image description here

I don't know why there's a discrepancy between moviepy and Windows/VLC (which are correct).

EDIT: Here is a copy of the example video that I am using. It has been compressed using 32-bit FFDshow codec.

https://omgplc-my.sharepoint.com/:v:/g/personal/nev_pires_vicon_com/EWp_HU26DWhOhE6HSMPER1AB7JDhV3DR8-ohLuCjb6lAvQ?nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJPbmVEcml2ZUZvckJ1c2luZXNzIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXciLCJyZWZlcnJhbFZpZXciOiJNeUZpbGVzTGlua0RpcmVjdCJ9fQ&e=R47TWt

0

There are 0 best solutions below