Bug with VideoReader class using R2019a

3 views (last 30 days)
Valentin Doguet
Valentin Doguet on 23 Apr 2019
Answered: Margaret Pinson on 30 Jul 2019
Hi all,
The following script worked perfectly fine with Matlab R2018b under a PC machine. I now installed version R2019a and the script remains busy for a while after the first third of my video, without trhowing error or crash report. I did try with the same video and another old Matlab version, the script works.
I assume there's some bugs with the last Matlab R219a version, and this might be one if these.
Am I right?
Thank you.
Valentin
filePath = 'test.avi';
%Create video Object
movObj = VideoReader(filePath);
%Get some properties
duration = movObj.Duration;
height = movObj.Height;
width = movObj.Width;
nbF = movObj.NumberOfFrame;
%Recreate the object since we called NumberOfFrame method
movObj = VideoReader(filePath);
%Allocate enough memory for all frames to import
frames = zeros(height, width, 3, nbF, 'uint8');
%Get frame one-by-one
waitB = waitbar(0, 'Read Frames');
i = 1;
while hasFrame(movObj)
%Get the next frame
frames(:, :, :, i) = readFrame(movObj);
i = i + 1;
%Update waitbar if any
if exist('waitB', 'var') && isvalid(waitB)
waitbar(movObj.CurrentTime/movObj.Duration, waitB)
end
end
delete(waitB)

Answers (1)

Margaret Pinson
Margaret Pinson on 30 Jul 2019
I am also having problems with VideoReader, hasFrame, and readFrame in MATLAB 2019a. There are inconsistencies where the first frame is read twice or the last frame won't read.

Categories

Find more on Startup and Shutdown 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!