Skip to content

Instantly share code, notes, and snippets.

@alalek
Created October 6, 2015 11:51
Show Gist options
  • Save alalek/e6cf477d79f85d714912 to your computer and use it in GitHub Desktop.
Save alalek/e6cf477d79f85d714912 to your computer and use it in GitHub Desktop.
import sys
import cv2
print "OpenCV version: %s" % cv2.__version__
print "OpenCV build info: %s" % cv2.getBuildInformation()
inputFile = sys.argv[1]
print "Input: %s" % inputFile
capture = cv2.VideoCapture(inputFile)
width = int(capture.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(capture.get(cv2.CAP_PROP_FRAME_HEIGHT))
fps = int(capture.get(cv2.CAP_PROP_FPS))
fourcc = int(capture.get(cv2.CAP_PROP_FOURCC))
print "width=%r height=%r fps=%r fourcc=%x" % (width, height, fps, fourcc)
frames = 0
while True:
flag, frame = capture.read()
if flag == 0:
break
frames += 1
print "Frames: %d" % frames
capture.release()
print "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment