I'm trying to read frames from a hevc(h265)
.avi video in opencv-python
(python3, latest version) but keeps throwing
OpenCV(4.1.1) C:\projects\opencv-python\opencv\modules\videoio\src\cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): C:\Users\gabri\Desktop\2019-11-22_13\a.avi in function 'cv::icvExtractPattern'.
I've tried both in ubuntu
and windows 10
using opencv-python, opencv-contrib-python and opencv-contrib-python-nonfree
, but it didn't work.
Thank you in advance.
Code used to read the video:
import cv2
import imutils
cap = cv2.VideoCapture("C:\\Users\\gabri\\Desktop\\2019-11-22_13\\a.avi")
while True:
ret,frame = cap.read()
if not ret:
break
frame = imutils.resize(frame,width = 960)
cv2.imshow('image',frame)
k = cv2.waitKey(1) & 0xff
if k == 27:
break
Perhaps this is late, but definitely there will be other people who face the same issue.
You can get this error in VideoWriter class if you do not specify your extension in the file name, in my case I have forgotten to write .mp4.
Hopefully this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With