|
视频文件是avi格式,大小45M 分辨率 1280x720
源码:
import sys
import cv2
if __name__ == '__main__':
if sys.argv[1] is None:
print("please specify a video filename\n");
exit(1)
video_file = sys.argv[1]
cap = cv2.VideoCapture(video_file)
if not cap.isOpened():
print('video file {} open failed\n'.format(video_file))
exit(1)
while True:
ret,frame = cap.read()
if not ret:
break
cv2.imshow('frame',frame)
cv2.waitKey(500)
cv2.destroyAllWindows()
cap.release()
报错如下
OpenCV(3.4.1) Error: Assertion failed (chunk.m_size <= 0xFFFF) in readFrame, file /builddir/build/BUILD/opencv-3.4.1/modules/videoio/src/container_avi.cpp, line 514
Traceback (most recent call last):
File "rknn_rk.py", line 19, in <module>
ret,frame = cap.read()
cv2.error: OpenCV(3.4.1) /builddir/build/BUILD/opencv-3.4.1/modules/videoio/src/container_avi.cpp:514: error: (-215) chunk.m_size <= 0xFFFF in function readFrame
google了一下 ,分析是opencv 3.4.1的bug 于是尝试通过pip升级opencv,但升级失败
(venv) [toybrick@localhost rknn]$ pip install opencv-python
Collecting opencv-python
ERROR: Could not find a version that satisfies the requirement opencv-python (from versions: none)
ERROR: No matching distribution found for opencv-python
请问如下在当前的SDk下 使用python的opencv 读取视频文件?
|
|