Opencv play the videos too slow

Viewed 9344

I wrote a program with Python to play some videos with Opencv... It works correctly in Windows 10. But I want to run it with Raspberry, and the problem is that the videos will be played too slow. I used OMXplayer and it plays the files very smoothly. So the problem is not Raspberry.(I think so...)

I simplified my code:

print "---Playing the Videos and Images---"
cap = cv2.VideoCapture(str(VideoPath))
while cap.isOpened():
 ret, frame = cap.read()
 if ret == True:
  cv2.imshow('videoWindow',frame)
 if cv2.waitKey(25) & 0xFF == ord('q'):
  a=2
  break

cv2.destroyAllWindows()
print "!...Done...!"

Could you tell me what the problem is?

1 Answers
Related