Search code examples
pythonarraysnumpyvideodisk

Video to numpy on disk


I have a .mp4 video file that I would like to get into an numpy array and store on disk with numpy.memmap, but it is too large to read in all at once. I know how to process the file frame by frame with scikit video, but not how to then pump that to a single numpy file on disk. Does anyone know how this can be done?


Solution

  • An uncompressed video is a large amount of data...this answer gives you some idea of how much memory you'd need ("roughly 33 GB per minute for 8-bit 24 fps").

    I remember attempting to do something similar when I was getting started with openCV. I'd suggest you're probably coming at your problem wrong. But if you really want to do it, you can use numpy.save.

    This answer has some good tips on better data formats for large data sets.