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:
'aviread' reads only the first frame...

Subject: 'aviread' reads only the first frame...

From: Johannes Huth

Date: 10 Feb, 2009 12:53:01

Message: 1 of 2

Hi,

I encountered a problem I am not able to puzzle out.
I try to read out avi frames (one by one). This works fine on most avi files I am using.

However, now I have a file, where there is an interesting (and also anoying) bahaviour:

The function
f = aviread(foo.avi,n)
does not return the n'th frame, but always only the first frame of the movie.

I experimented a bit and found out, that if I request the following:
f = aviread(foo.avi,[n-1,n])

f(2) will old the correct n'th frame.

? I don't get it ^^
The Avi can be batch loaded with aviread(foo.avi) and played with movie(f)....
Only the single frame request does not work...
I think there may be a bug in 'readavi', is that possible?

Any ideas?
Regards
Joh

---
System: WinXP, Matlav v7.2,
Aviinfo:
fileinfo.Filename = foo.avi
fileinfo.FileSize = 3.8109e+008
fileinfo.NumFrames = 88
fileinfo.FramesPerSecond = 10
fileinfo.Width = 1388
fileinfo.Height = 1040
fileinfo.ImageType = 'truecolor'
fileinfo.VideoCompression = 'none'
fileinfo.Quality = 0;
fileinfo.NumColormapEntries = 0;

Subject: 'aviread' reads only the first frame...

From: Nick Haddad

Date: 10 Feb, 2009 14:04:49

Message: 2 of 2

Joh,

It is possible that this is a bug with aviread. I would give the same
file a try with mmreader, which is a newer way to read video files in
matlab:

vidObj = mmreader('foo.avi');
f = read(vidObj, n);

You should get more consistent results with mmreader.

-Nick

On 2/10/09 7:53 AM, Johannes Huth wrote:
> Hi,
>
> I encountered a problem I am not able to puzzle out.
> I try to read out avi frames (one by one). This works fine on most avi files I am using.
>
> However, now I have a file, where there is an interesting (and also anoying) bahaviour:
>
> The function
> f = aviread(foo.avi,n)
> does not return the n'th frame, but always only the first frame of the movie.
>
> I experimented a bit and found out, that if I request the following:
> f = aviread(foo.avi,[n-1,n])
>
> f(2) will old the correct n'th frame.
>
> ? I don't get it ^^
> The Avi can be batch loaded with aviread(foo.avi) and played with movie(f)....
> Only the single frame request does not work...
> I think there may be a bug in 'readavi', is that possible?
>
> Any ideas?
> Regards
> Joh
>
> ---
> System: WinXP, Matlav v7.2,
> Aviinfo:
> fileinfo.Filename = foo.avi
> fileinfo.FileSize = 3.8109e+008
> fileinfo.NumFrames = 88
> fileinfo.FramesPerSecond = 10
> fileinfo.Width = 1388
> fileinfo.Height = 1040
> fileinfo.ImageType = 'truecolor'
> fileinfo.VideoCompression = 'none'
> fileinfo.Quality = 0;
> fileinfo.NumColormapEntries = 0;

Tags for 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