opencv - How to know total number of Frame in a file with cv2 in python -


how know total number of frame in file ( .avi) through python using open cv module.

if possible information (resolution, fps,duration,etc) can of video file through this.

import cv2  cap = cv2.videocapture(fn)  if not cap.isopened():      print "could not open :",fn     return  length = int(cap.get(cv2.cv.cv_cap_prop_frame_count)) width  = int(cap.get(cv2.cv.cv_cap_prop_frame_width)) height = int(cap.get(cv2.cv.cv_cap_prop_frame_height)) fps    = cap.get(cv2.cv.cv_cap_prop_fps) 

see here more info.

also, of grain of salt, not props mandatory, might not available capture / video codec


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -