Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import cv2
- import numpy
- import time
- import sys
- filename = sys.argv[1]
- vs = cv2.VideoCapture(filename)
- more = True
- framecounter = 0
- start_time = time.time()
- while more:
- framecounter += 1
- frame = vs.read()
- more = frame[0]
- stop_time = time.time()
- duration = stop_time - start_time
- print("Filename: {}".format(filename))
- print("Elapsed : {0:.2f} s".format(duration))
- print("FPS : {0:.2f} fps".format(framecounter/duration))
- print("\n")
- 000 [enrico@HAL9000]: .../m_det_py $ python test.py test_11.mp4 && python test.py test_30.mp4 && python test.py test_59.mp4
- Filename: test_11.mp4
- Elapsed : 29.91 s
- FPS : 11.07 fps
- Filename: test_30.mp4
- Elapsed : 29.99 s
- FPS : 29.91 fps
- Filename: test_59.mp4
- Elapsed : 8.59 s
- FPS : 60.16 fps
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement