Created
October 20, 2022 21:46
-
-
Save victormurcia/734b8b9cec8120c3b2adb0da9f7bcb64 to your computer and use it in GitHub Desktop.
count frames in mp4 file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Determine number of frames in video | |
| def count_frames(video_file): | |
| """ | |
| Args: | |
| video_file: (str) path to .MP4 video file | |
| Returns: | |
| nFrames: (int) Number of frames in mp4 | |
| """ | |
| cap = cv2.VideoCapture(video_file) | |
| length = int(cap.get(cv2.CAP_PROP_FRAME_COUNT)) | |
| return(length) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment