I cant figure out what the problem is.
I am using
- Ubuntu 17.04
- Python 2.7.13
- OpenCV Version: 3.3.0
I have gone through all the related problems on internet but have not got the solution for the problem yet. 'v.mp4' file is in the same directory in which my python file is present.
CODE
import cv2 vidcap = cv2.VideoCapture('v.mp4') success,image = vidcap.read() count = 0; print success while success: success,image = vidcap.read() cv2.imwrite("frame%d.jpg" % count, image) # save frame as JPEG file if cv2.waitKey(10) == 27: # exit if Escape is hit break count += 1
while vidcap.isOpened()? Can you ensure the file is being read? Also try displaying the frame first usingcv2.imshow()before writing it?$pip install opencv-python