VideoReaderを使って動画を再生したいが、容量オーバーのエラーが出る
Show older comments
Matlab Home2020bを使用しています。
VideoReaderを使って動画の再生まで行いたいです。
v = VideoReader('sample_video.mp4');
m = zeros(v.Height, v.Width, 3, int64(v.FrameRate*v.Duration),'uint8');
k = 1;
while hasFrame(v)
m(:,:,:,k) = readFrame(v);
k = k + 1;
end
implay(m, v.FrameRate)
imtool(m(:,:,:,1),'InitialMagnification','fit')
imtool(m(:,:,:,800),'InitialMagnification','fit')
しかし、2行目の処理で以下のようなエラーが出てしまいます。
-------------------------
エラー: zeros
要求された 1080x1920x3x1501 (8.7GB) 配列は、最大配列サイズの基本設定を超えています。この制限より大きい配列を作成すると、処理に時間がかかり、MATLAB が反応しなくなることがあります。
-------------------------
CPUのメモリ不足が原因なのでしょうか?
参考画像:変数 v の詳細
Accepted Answer
More Answers (0)
Categories
Find more on オーディオとビデオ in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!