Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 memory issue loading movie to numpy array
#1
I have a movie, .mts file, that I want to be able to read into a numpy array that is (w,h,3,f), where w is the frame's width, h its height, and f the number of frames in the movie. 3 refers to the RGB value. Below is my program for doing it. My problem though is that when I run it that it consumes all of the memory on my computer and everything freezes up. I don't understand why since the movie is only 26 MB and I have 3.7GB of RAM memory . I am using Spyder and when not running it says memory is 36% in the lower right hand corner and then jumps up to 96% memory when the program is running and freezes. Why is this happening and how do I fix this? Is there a better way to write this?

import cv2
    
cap2 = cv2.VideoCapture('//home//jr//Desktop//Movie1.MTS')
movieA=[]
while(cap2.isOpened()):
    status, frame = cap2.read()
    if status==True:
        movieA.append(frame)
    else:
        break
cap2.release()
Quote
#2
The video file is encoded and shrinked in size, if you want an array of the data
it needs to be decoded and that means the amount is increasing dramatically.
https://www.wowza.com/blog/video-codecs-encoding
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Numpy structured array Nitram 3 219 Sep-17-2019, 10:09 PM
Last Post: jefsummers
  array issue paul18fr 2 174 Aug-04-2019, 07:07 AM
Last Post: paul18fr
  numpy.copy / numpy.delete paul18fr 3 262 Jul-26-2019, 01:51 PM
Last Post: paul18fr
  AttributeError: module 'numpy' has no attribute 'array aapurdel 7 4,090 May-29-2019, 02:48 AM
Last Post: heiner55
  Array in numpy Truman 5 4,106 May-26-2019, 10:14 AM
Last Post: snippsat
  [split] Array in numpy aapurdel 1 280 May-25-2019, 08:05 PM
Last Post: buran
  [numpy]add a value to an array elmismo999 1 364 May-23-2019, 04:15 PM
Last Post: michalmonday
  "erlarge" a numpy-matrix to numpy-array PhysChem 2 406 Apr-09-2019, 04:54 PM
Last Post: PhysChem
  while creating a array using numpy.arrange, how to negate only the last 50 numbers? vicky53 1 403 Apr-06-2019, 11:52 AM
Last Post: scidam
  How to get the size of a numpy array? mcgrim 2 453 Mar-23-2019, 02:25 PM
Last Post: perfringo

Forum Jump:


Users browsing this thread: 1 Guest(s)