arjun gupta
arjun gupta

Reputation: 3

Read after Videocapture on opencv always returns false

I cant figure out what the problem is.

I am using

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

Upvotes: 0

Views: 3069

Answers (2)

Aleks Vidmantas
Aleks Vidmantas

Reputation: 69

For me, I used pycharm as my ide. Every isopened() and read() showed up false. All I had to do to was change the python version that pycharm used to python 2.

Upvotes: 0

alkasm
alkasm

Reputation: 23002

The opencv-python package does not have VideoCapture() support outside of Windows. See my answer here or the PyPI opencv-python documentation, which states:

IMPORTANT NOTE

MacOS and Linux packages do not support video related functionality (not compiled with FFmpeg).

Upvotes: 1

Related Questions