cv2.Videocapture() works fine while using webcam but while trying to read from hard drive it shows error cap.isOpened() returns false
import cv2
import nump
I was getting the same error while using opencv in anaconda3 virtual environment. I checked the buildinformation for current opencv version and ffmpeg was marked "no".
To resolve this
Installed latest ffmpeg using conda-forge channel (conda install -c conda-forge ffmpeg)
Name Version Build Channel
ffmpeg 4.0.2 ha6a6e2b_0 conda-forge
Then installed opencv again using conda-forge channel (conda install -c conda-forge opencv)
Name Version Build Channel
opencv 3.4.1 py36_blas_openblash829a850_201 [blas_openblas] conda-forge
Restart the python console after doing this and import cv2.