Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
mmreader problems

Subject: mmreader problems

From: Nic Roberts

Date: 23 Aug, 2011 20:03:27

Message: 1 of 1

Hi,

I am reading in an AVI file using mmreader. I need to captuire certain frames and convert then to an image file (format not important). So far I have managed to read in the file but whenever I try to 'read' a specific frame I can only read frame 1.

In fact when I use 'last=read(ValveObj, inf)' I still only get frame 1. The number of frames variable says there are 330 frames.

I did thnk that there might be an issue with variable frame rate but this wouldnt account for there only being one frame to read in though would it?

I can watch the avi in Windows Media Player with no problem.

I tried to use this example file from the online help........

MVObj = cannon;

nFrames = MVObj.NumberOfFrames;
vidHeight = MVObj.Height;
vidWidth = MVObj.Width;

% Preallocate movie structure.
mov(1:nFrames) = ...
    struct('cdata', zeros(vidHeight, vidWidth, 3, 'uint8'),...
           'colormap', []);

% Read one frame at a time.
for k = 1 : nFrames
    mov(k).cdata = read(MVObj, k);
end

% Size a figure based on the video's width and height.
hf = figure;
set(hf, 'position', [150 150 vidWidth vidHeight])

% Play back the movie once at the video's frame rate.
movie(hf, mov, 1, MVObj.FrameRate);

.............to reconstruct the movie but oddly the file returned an error when it got to k=192.

Can somebody explain what's going on please.

Yours perplexed

Nic

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us