video - Matlab thinks an AVI it's written is corrupt -
i'm using matlab interface scientific camera using mex, , matlab program uses videowriter()
write file disc. camera rgb-capable, , if write file such, video fine. however, current application, need grayscale images, , i'm using rgb2gray()
convert it. unfortunately, when analysis code tried read video file again, error:
error using videoreader/init (line 450) unable read file. file appears corrupt.
and attempting read video vlc confirms corrupt. difference in code between grayscale , colour versions line:
frame = rgb2gray(frame);
my whole writing section of code is:
vid = videowriter('testvid.avi'); vid.framerate = framerate; vid.quality = 100; open(vid); = 1 : frames; %read frame data variable 'frame' frame = rgb2gray(frame); writevideo(vid,frame); end
i've spent far long fighting this, ideas?
you need close video object, using close(vid)
after writing last frame.
Comments
Post a Comment