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.where array search for string in just one coordinate adetheheat 1 139 Jan-09-2020, 07:09 PM
Last Post: paul18fr
  Numpy saving and loading introduces zeros in the middle of every element DreamingInsanity 0 100 Dec-11-2019, 07:21 PM
Last Post: DreamingInsanity
  Numpy structured array Nitram 3 313 Sep-17-2019, 10:09 PM
Last Post: jefsummers
  array issue paul18fr 2 232 Aug-04-2019, 07:07 AM
Last Post: paul18fr
  numpy.copy / numpy.delete paul18fr 3 362 Jul-26-2019, 01:51 PM
Last Post: paul18fr
  AttributeError: module 'numpy' has no attribute 'array aapurdel 7 6,831 May-29-2019, 02:48 AM
Last Post: heiner55
  Array in numpy Truman 5 4,360 May-26-2019, 10:14 AM
Last Post: snippsat
  [split] Array in numpy aapurdel 1 347 May-25-2019, 08:05 PM
Last Post: buran
  [numpy]add a value to an array elmismo999 1 479 May-23-2019, 04:15 PM
Last Post: michalmonday
  "erlarge" a numpy-matrix to numpy-array PhysChem 2 489 Apr-09-2019, 04:54 PM
Last Post: PhysChem

Forum Jump:


Users browsing this thread: 1 Guest(s)