Сообщение об ошибке: < /p>
Код: Выделить всё
[ WARN:[email protected]] global cap_ffmpeg_impl.hpp:1541 grabFrame packet read max attempts exceeded, if your video have multiple streams (video, audio) try to increase attempt limit by setting environment variable OPENCV_FFMPEG_READ_ATTEMPTS (current value is 10000)
< /code>
минимальный воспроизводимый пример < /p>
import os
import cv2
videofilename = "test.mp4"
capture = cv2.VideoCapture(videofilename)
frameNum = 0
createfolder = os.getcwd() + '/' + videofilename.split(".")[0] + '/'
if not os.path.exists(createfolder):
os.makedirs(createfolder)
os.makedirs(createfolder + "/frames/")
while True:
success, frame = capture.read()
if success is False:
break
frameNum += 1
framedownloadname = videofilename.split(".")[0] + '-fr' + str(frameNum) + '.jpg'
framedownloadloc = createfolder + '/frames/' + framedownloadname
print(framedownloadloc)
cv2.imwrite(framedownloadloc, frame)
img = cv2.imread(framedownloadloc)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
capture.release()
Подробнее здесь: https://stackoverflow.com/questions/780 ... xactly-rea