0

I am trying to read several .mp4 videos from a .zip folder for further processing. Trying to used zipfile and OpenCV like this:

zf = ZipFile(video_zip_loc)
all_files = zf.namelist()
video_file = zf.read(all_files[0])

cap = cv2.VideoCapture(video_file)

But get the following error

TypeError: an integer is required (got type bytes)

Also attempted to use

np.frombuffer(video_file, np.uint8)

As suggested here: Using python opencv to load image from zip. This returns a 1D array and I am not sure how to convert it into a sequence of images. If I try sticking it into VideoCapture get the following error:

TypeError: only size-1 arrays can be converted to Python scalars

Is there a solution to this? Or should I just unzip all the videos first? (Several GB of data...)

Vlad
  • 33
  • 4
  • `cv2.VideoCapture` requires a file name as input argument. – Rotem Mar 01 '20 at 23:15
  • always put full error message (starting at word "Traceback") in question (not comment) as text (not screenshot). There are other useful information. – furas Mar 02 '20 at 00:12
  • As far as I know there is no solution using OpenCV. There is a solution using FFmpeg, but it's a complicated solution. I think you better unzip all the videos first. – Rotem Mar 02 '20 at 21:43

0 Answers0