“找不到起始号码(以文件名)"尝试从opencv中的hevc(h265)视频读取帧时 [英] "Can't find starting number (in the name of file)" when trying to read frames from hevc (h265) video in opencv
问题描述
我正在尝试从opencv-python
(python3,最新版本)的hevc(h265)
.avi视频中读取帧,但是不断抛出
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: 错误:(-5:错误的参数)CAP_IMAGES:找不到起始编号(在 文件名):C:\ Users \ gabri \ Desktop \ 2019-11-22_13 \ a.avi在 函数'cv :: icvExtractPattern'.
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'.
我已经在ubuntu
和windows 10
中使用opencv-python, opencv-contrib-python and opencv-contrib-python-nonfree
进行了尝试,但是没有用.
预先谢谢你.
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.
用于读取视频的代码:
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
推荐答案
我遇到了同样的问题,编译和链接正常,但是在运行时发生了相同的隐秘错误.
I had the same problem, compilation and linking ok, but the same cryptic error occurs at running.
(在Windows中)当无法访问opencv_videoio_ffmpeg430_64.dll
时发生(它似乎被另一个opencv库静默调用).您可能没有使用-DWITH_FFMPEG=ON
构建opencv,或者您的dll不在路径中.
It happened (with Windows) when opencv_videoio_ffmpeg430_64.dll
was not accessible (it seems to be silently called by another opencv lib). Either you did not build opencv with the -DWITH_FFMPEG=ON
, or alternatively your dll is not in the path.
这篇关于“找不到起始号码(以文件名)"尝试从opencv中的hevc(h265)视频读取帧时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!