Advertisement
tpaper

Untitled

Oct 17th, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. import cv2
  2. import numpy
  3. import time
  4. import sys
  5.  
  6. filename = sys.argv[1]
  7.  
  8. vs = cv2.VideoCapture(filename)
  9.  
  10. more = True
  11. framecounter = 0
  12. start_time = time.time()
  13.  
  14. while more:
  15.     framecounter += 1
  16.     frame = vs.read()
  17.     more = frame[0]
  18.  
  19. stop_time = time.time()
  20. duration = stop_time - start_time
  21.  
  22. print("Filename: {}".format(filename))
  23. print("Elapsed : {0:.2f} s".format(duration))
  24. print("FPS     : {0:.2f} fps".format(framecounter/duration))
  25. print("\n")
  26.  
  27. 000 [enrico@HAL9000]: .../m_det_py $ python test.py test_11.mp4 && python test.py test_30.mp4 && python test.py test_59.mp4
  28. Filename: test_11.mp4
  29. Elapsed : 29.91 s
  30. FPS     : 11.07 fps
  31.  
  32.  
  33. Filename: test_30.mp4
  34. Elapsed : 29.99 s
  35. FPS     : 29.91 fps
  36.  
  37.  
  38. Filename: test_59.mp4
  39. Elapsed : 8.59 s
  40. FPS     : 60.16 fps
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement