VideoReader with small mp4 files uses all memory
1 次查看(过去 30 天)
显示 更早的评论
I have an AVCHD video file, which I convert with handbrake into .mp4 file. Then I am trying to store the whole file into a structure array (it's an operation which I always do with other videos, and the code works just perfectly fine). But this time, with a (only) 125MB video, the memory of my laptop (I have 16GB!) increases very quicly and gets full, until I get the out of memory error. I also tried to convert the video to a lower (super low) quality and I got a 5MB file, but when reading it I have the same memory usage increase until it gets full. The curious thing is that I get the out of memory error when there is just 1 frame to read to finish.
There is clearly something wrong happening here, do you have any hint? I'm running MATLAB 2016b.
3 个评论
Walter Roberson
2017-2-27
You are reallocating cama each time through the loop. You should determine how many frames you have, allocate cama as a struct with that many elements, and then go back and read the frames.
You will need to use the same basic framework of hasFrame to count the frames; the number-of-frames field is an estimate.
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!