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:
avi compression in Windows 7

Subject: avi compression in Windows 7

From: Tim

Date: 1 Aug, 2010 12:53:05

Message: 1 of 15

Problem:
The default compression method for movie2avi is Indeo5. However, by default, Windows 7 does not include Indeo5 (nor most other codecs). So, when using the simplest implementation of movie2avi [e.g. movie2avi(mov, filename);] we get the following warning:
Warning: Cannot locate Indeo5 compressor, using 'None' as the compression type.
See Mathworks Technical Solution 1-4G50RI for more information.

In short, Technical Solution 1-4G50RI suggests:
1) use a patch (for Windows XP users)
2) use a workaround: movie2avi(mov, filename, 'compression', 'Cinepak');

These solutions do not work for default Windows 7 installations: the 1st solution is a patch for XP (not Windows 7) and the 2nd solution requires the user to use Cinepak which also is not available on Windows 7.

The only "out of the box" way to use mov2avi is to use 'none' compression [e.g. movie2avi(mov, filename, 'compression', 'none');] but doing so obviously prevents us from compressing the file (MATLAB doesn't allow using RLE or MSVC encoding for truecolor images). This can be a problem since uncompressed avi files get big very quickly, especially with large frame sizes. We have found a very quick and easy solution to this problem using "ffdshow". Our solution produces a warning: (Warning: Not a supported compression method.), but it works. We are posting the solution here in the hopes that others will find it useful (searching online for a solution turned up many people with the same problem).

Solution:
Download and install ffdshow: (http://sourceforge.net/projects/ffdshow-tryout/files/)
Note that we are using 64 bit Windows 7 and used the 64 bit version of ffdshow (we didn't try the 32 bit version so it might not work).

In the call to movie2avi(), use FFDS as the compression type as in:
movie2avi((mov, filename, 'compression', 'FFDS');

That's it. With that, you get a decently compressed file.

Below we give an example. The FFDS compression in this example generates a 856Kb file as opposed to a 265MB(!) file that would be generated without compression. Note that the avi file size is screen size dependent in this example.

NUMBER_OF_FRAMES = 100;
filename = 'mymovie.avi';

scrsz = get(0,'ScreenSize');
myfig=figure('Position',[1 1 scrsz(3) scrsz(4)]); %make the frame size fixed
figure(myfig);

for x=1:NUMBER_OF_FRAMES
y = sin(x);
plot(x,y, '.b', 'LineWidth', 2); hold on;
axis equal; %not necessary but easier to follow the sin() video visually
mov(x) = getframe(myfig);
end;

movie2avi(mov, filename, 'compression', 'FFDS');

Subject: avi compression in Windows 7

From: Max Katz

Date: 17 Mar, 2011 12:07:05

Message: 2 of 15

Tim,

Thanks for posting this! I, for one, am grateful that I found this. I am using 64-bit Windows 7 and I was generating ~ 1 GB AVI files for my research; this solution reduced the file size to ~ 6 MB with an acceptable loss of quality for the compression. It is a much better solution than using free software for converting the AVI files to a lossy format; the artifacts around the text especially were of unacceptably low quality.

Max Katz

Subject: avi compression in Windows 7

From: Qingping

Date: 4 May, 2011 17:03:04

Message: 3 of 15

Under your help, I install ffdshow codec, but i got a error as list below:
===============
Warning: Not a supported compression method. An attempt will be made to use this
compressor.
> In avifile.set>setCompression at 185
  In avifile.set at 43
  In avifile.avifile at 166
  In movie2avi at 63
  In W_CitcomOneCase_T2Avi at 168
  In run at 57
??? Error using ==> avi
Failed to set stream format. Try specifying a different codec.

Error in ==> avifile.addframe at 188
      avi('addframe',rot90(frame,-1), aviobj.Bitmapheader, ...

Error in ==> movie2avi at 64
avimov = addframe(avimov,mov);

Error in ==> Test_movie2avi at 168
movie2avi(mymov,['mytest.avi'],'compression','FFDS');

Error in ==> run at 57
          evalin('caller', [s ';']);

===============

what happen?

Subject: avi compression in Windows 7

From: marlin

Date: 9 Jul, 2011 15:11:10

Message: 4 of 15

Hi,

maybe you have to change the windows themes to classic style.
it works for me :D

Subject: avi compression in Windows 7

From: Piet

Date: 12 Aug, 2011 14:48:13

Message: 5 of 15

> Solution:
> Download and install ffdshow: (http://sourceforge.net/projects/ffdshow-tryout/files/)
> Note that we are using 64 bit Windows 7 and used the 64 bit version of ffdshow (we didn't try the 32 bit version so it might not work).


Thanks for posting this ffdshow!

however, it doesn't work for me. I am using exactly the same system with matlab R2011b. Where should I install the program?

I got the following error message btw:

Warning: Not a supported compression method. An attempt will be made to use this compressor.
> In avifile.set>setCompression at 189
  In avifile.set at 43
  In avifile.avifile at 166
  In movie2avi at 63
  In MovieMaker at 64
??? Error using ==> avi
Can not locate compressor.

Error in ==> avifile.addframe at 190
      avi('addframe',rot90(frame,-1), aviobj.Bitmapheader, ...

Error in ==> movie2avi at 64
avimov = addframe(avimov,mov);

Error in ==> MovieMaker at 64
movie2avi(frame_wave,'HDD_03.avi','compression','FFDS')
 

Subject: avi compression in Windows 7

From: Joana

Date: 11 Jul, 2012 23:14:38

Message: 6 of 15

Hi all,
To compress .avi files in matlab on Windows7 (x64) try downloading the latest "Windows7 Codec Pack" at:
http://www.windows7codecs.com/
It has the 'ffds' codec and others that might be useful.
It worked for me!
(using R2011a)
good luck!

Subject: avi compression in Windows 7

From: Dominic

Date: 12 Sep, 2012 15:12:07

Message: 7 of 15

"Tim" wrote in message <i33qnh$j5l$1@fred.mathworks.com>...
> Problem:
> The default compression method for movie2avi is Indeo5. However, by default, Windows 7 does not include Indeo5 (nor most other codecs). So, when using the simplest implementation of movie2avi [e.g. movie2avi(mov, filename);] we get the following warning:
> Warning: Cannot locate Indeo5 compressor, using 'None' as the compression type.
> See Mathworks Technical Solution 1-4G50RI for more information.
>
> In short, Technical Solution 1-4G50RI suggests:
> 1) use a patch (for Windows XP users)
> 2) use a workaround: movie2avi(mov, filename, 'compression', 'Cinepak');
>
> These solutions do not work for default Windows 7 installations: the 1st solution is a patch for XP (not Windows 7) and the 2nd solution requires the user to use Cinepak which also is not available on Windows 7.
>
> The only "out of the box" way to use mov2avi is to use 'none' compression [e.g. movie2avi(mov, filename, 'compression', 'none');] but doing so obviously prevents us from compressing the file (MATLAB doesn't allow using RLE or MSVC encoding for truecolor images). This can be a problem since uncompressed avi files get big very quickly, especially with large frame sizes. We have found a very quick and easy solution to this problem using "ffdshow". Our solution produces a warning: (Warning: Not a supported compression method.), but it works. We are posting the solution here in the hopes that others will find it useful (searching online for a solution turned up many people with the same problem).
>
> Solution:
> Download and install ffdshow: (http://sourceforge.net/projects/ffdshow-tryout/files/)
> Note that we are using 64 bit Windows 7 and used the 64 bit version of ffdshow (we didn't try the 32 bit version so it might not work).
>
> In the call to movie2avi(), use FFDS as the compression type as in:
> movie2avi((mov, filename, 'compression', 'FFDS');
>
> That's it. With that, you get a decently compressed file.
>
> Below we give an example. The FFDS compression in this example generates a 856Kb file as opposed to a 265MB(!) file that would be generated without compression. Note that the avi file size is screen size dependent in this example.
>
> NUMBER_OF_FRAMES = 100;
> filename = 'mymovie.avi';
>
> scrsz = get(0,'ScreenSize');
> myfig=figure('Position',[1 1 scrsz(3) scrsz(4)]); %make the frame size fixed
> figure(myfig);
>
> for x=1:NUMBER_OF_FRAMES
> y = sin(x);
> plot(x,y, '.b', 'LineWidth', 2); hold on;
> axis equal; %not necessary but easier to follow the sin() video visually
> mov(x) = getframe(myfig);
> end;
>
> movie2avi(mov, filename, 'compression', 'FFDS');


hello Tim,
I've tried out what you've mentioned above, surprisingly it works well to compress the video quite much. But i got some problem when i play back the video file with media player. The video looks really strange when I play it. I guess it's maybe the reason for the player's decoder.
I wonder if you have met this problem or not. Do you have any suggestion for that!

Thank you in advance!

Dominic

Subject: avi compression in Windows 7

From: Jakub

Date: 12 Apr, 2013 10:22:05

Message: 8 of 15

> hello Tim,
> I've tried out what you've mentioned above, surprisingly it works well to compress the video quite much. But i got some problem when i play back the video file with media player. The video looks really strange when I play it. I guess it's maybe the reason for the player's decoder.
> I wonder if you have met this problem or not. Do you have any suggestion for that!
>
> Thank you in advance!
>
> Dominic

I got the same problem as Dominic. The video looks somehow inclided and strange at all.

Subject: avi compression in Windows 7

From: shane

Date: 14 May, 2013 04:28:16

Message: 9 of 15

"Jakub " <j-kopal@seznam.cz> wrote in message <kk8n8d$ei$1@newscl01ah.mathworks.com>...
> > hello Tim,
> > I've tried out what you've mentioned above, surprisingly it works well to compress the video quite much. But i got some problem when i play back the video file with media player. The video looks really strange when I play it. I guess it's maybe the reason for the player's decoder.
> > I wonder if you have met this problem or not. Do you have any suggestion for that!
> >
> > Thank you in advance!
> >
> > Dominic
>
> I got the same problem as Dominic. The video looks somehow inclided and strange at all.

For AVI compression, you may check <a href="http://www.ilikemall.com/how-to/convert-avi-to-mov-mac.html">avi mov converter</a>

Subject: avi compression in Windows 7

From: Ross

Date: 27 Sep, 2013 09:24:05

Message: 10 of 15

i recommend idealshare videogo which helps to compress AVI, WTV, AVCHD, MTS, M2T, M2TS, MXF, MOD, Apple ProRes, R3D, MPEG-1, MPEG-2, MP4, MOV, DVR-MS, MVI, TOD etc
and compress audio formats in FLAC, WAV, Apple Lossless ALAC, AIFF, APE, AU, RA, SHN, WMA, MP3, CAF, FLAC, OGG and more.

Step by step guide at http://www.idealshare.net/video-converter/mkv-compressor.html

Subject: avi compression in Windows 7

From: Jose

Date: 9 Oct, 2013 09:40:09

Message: 11 of 15

I can't help sharing a full guide about how to compress avi files at:http://www.bigasoft.com/articles/how-to-compress-video-mkv-mpeg-avi-mp4-mov-wmv.html

Hope it's what you are looking for.

Subject: avi compression in Windows 7

From: Jelle

Date: 14 Apr, 2014 10:03:09

Message: 12 of 15

"Tim" wrote in message <i33qnh$j5l$1@fred.mathworks.com>...
> Problem:
> The default compression method for movie2avi is Indeo5. However, by default, Windows 7 does not include Indeo5 (nor most other codecs). So, when using the simplest implementation of movie2avi [e.g. movie2avi(mov, filename);] we get the following warning:
> Warning: Cannot locate Indeo5 compressor, using 'None' as the compression type.
> See Mathworks Technical Solution 1-4G50RI for more information.
>
> In short, Technical Solution 1-4G50RI suggests:
> 1) use a patch (for Windows XP users)
> 2) use a workaround: movie2avi(mov, filename, 'compression', 'Cinepak');
>
> These solutions do not work for default Windows 7 installations: the 1st solution is a patch for XP (not Windows 7) and the 2nd solution requires the user to use Cinepak which also is not available on Windows 7.
>
> The only "out of the box" way to use mov2avi is to use 'none' compression [e.g. movie2avi(mov, filename, 'compression', 'none');] but doing so obviously prevents us from compressing the file (MATLAB doesn't allow using RLE or MSVC encoding for truecolor images). This can be a problem since uncompressed avi files get big very quickly, especially with large frame sizes. We have found a very quick and easy solution to this problem using "ffdshow". Our solution produces a warning: (Warning: Not a supported compression method.), but it works. We are posting the solution here in the hopes that others will find it useful (searching online for a solution turned up many people with the same problem).
>
> Solution:
> Download and install ffdshow: (http://sourceforge.net/projects/ffdshow-tryout/files/)
> Note that we are using 64 bit Windows 7 and used the 64 bit version of ffdshow (we didn't try the 32 bit version so it might not work).
>
> In the call to movie2avi(), use FFDS as the compression type as in:
> movie2avi((mov, filename, 'compression', 'FFDS');
>
> That's it. With that, you get a decently compressed file.
>
> Below we give an example. The FFDS compression in this example generates a 856Kb file as opposed to a 265MB(!) file that would be generated without compression. Note that the avi file size is screen size dependent in this example.
>
> NUMBER_OF_FRAMES = 100;
> filename = 'mymovie.avi';
>
> scrsz = get(0,'ScreenSize');
> myfig=figure('Position',[1 1 scrsz(3) scrsz(4)]); %make the frame size fixed
> figure(myfig);
>
> for x=1:NUMBER_OF_FRAMES
> y = sin(x);
> plot(x,y, '.b', 'LineWidth', 2); hold on;
> axis equal; %not necessary but easier to follow the sin() video visually
> mov(x) = getframe(myfig);
> end;
>
> movie2avi(mov, filename, 'compression', 'FFDS');

This method worked for me (using MATLAB R2013b, W7 64-bit, latest ffdshow of 2014.02.09).

However, I think sometimes the movie gets over-compressed. The movies I currently make have a frame size of 424*400 and a different number of frames.
First I made one with 239 frames (~15 sec), which was initially over 100 MB but with compression it became 19MB with good quality.
The next movie was 273 frames (~18 sec), which compressed to 9 MB with poorer but acceptable quality.
Then I tried compressing 1800 frames (~2 min) resulting in a .avi file of again 9 MB, now with a huge and unacceptable loss of quality.

Does anyone know how to set the compression quality in order to solve this problem?

Subject: avi compression in Windows 7

From: Jelle

Date: 14 Apr, 2014 10:21:10

Message: 13 of 15

"Jelle" wrote in message <ligbot$37$1@newscl01ah.mathworks.com>...
> "Tim" wrote in message <i33qnh$j5l$1@fred.mathworks.com>...
> > Problem:
> > The default compression method for movie2avi is Indeo5. However, by default, Windows 7 does not include Indeo5 (nor most other codecs). So, when using the simplest implementation of movie2avi [e.g. movie2avi(mov, filename);] we get the following warning:
> > Warning: Cannot locate Indeo5 compressor, using 'None' as the compression type.
> > See Mathworks Technical Solution 1-4G50RI for more information.
> >
> > In short, Technical Solution 1-4G50RI suggests:
> > 1) use a patch (for Windows XP users)
> > 2) use a workaround: movie2avi(mov, filename, 'compression', 'Cinepak');
> >
> > These solutions do not work for default Windows 7 installations: the 1st solution is a patch for XP (not Windows 7) and the 2nd solution requires the user to use Cinepak which also is not available on Windows 7.
> >
> > The only "out of the box" way to use mov2avi is to use 'none' compression [e.g. movie2avi(mov, filename, 'compression', 'none');] but doing so obviously prevents us from compressing the file (MATLAB doesn't allow using RLE or MSVC encoding for truecolor images). This can be a problem since uncompressed avi files get big very quickly, especially with large frame sizes. We have found a very quick and easy solution to this problem using "ffdshow". Our solution produces a warning: (Warning: Not a supported compression method.), but it works. We are posting the solution here in the hopes that others will find it useful (searching online for a solution turned up many people with the same problem).
> >
> > Solution:
> > Download and install ffdshow: (http://sourceforge.net/projects/ffdshow-tryout/files/)
> > Note that we are using 64 bit Windows 7 and used the 64 bit version of ffdshow (we didn't try the 32 bit version so it might not work).
> >
> > In the call to movie2avi(), use FFDS as the compression type as in:
> > movie2avi((mov, filename, 'compression', 'FFDS');
> >
> > That's it. With that, you get a decently compressed file.
> >
> > Below we give an example. The FFDS compression in this example generates a 856Kb file as opposed to a 265MB(!) file that would be generated without compression. Note that the avi file size is screen size dependent in this example.
> >
> > NUMBER_OF_FRAMES = 100;
> > filename = 'mymovie.avi';
> >
> > scrsz = get(0,'ScreenSize');
> > myfig=figure('Position',[1 1 scrsz(3) scrsz(4)]); %make the frame size fixed
> > figure(myfig);
> >
> > for x=1:NUMBER_OF_FRAMES
> > y = sin(x);
> > plot(x,y, '.b', 'LineWidth', 2); hold on;
> > axis equal; %not necessary but easier to follow the sin() video visually
> > mov(x) = getframe(myfig);
> > end;
> >
> > movie2avi(mov, filename, 'compression', 'FFDS');
>
> This method worked for me (using MATLAB R2013b, W7 64-bit, latest ffdshow of 2014.02.09).
>
> However, I think sometimes the movie gets over-compressed. The movies I currently make have a frame size of 424*400 and a different number of frames.
> First I made one with 239 frames (~15 sec), which was initially over 100 MB but with compression it became 19MB with good quality.
> The next movie was 273 frames (~18 sec), which compressed to 9 MB with poorer but acceptable quality.
> Then I tried compressing 1800 frames (~2 min) resulting in a .avi file of again 9 MB, now with a huge and unacceptable loss of quality.
>
> Does anyone know how to set the compression quality in order to solve this problem?

I tried it again and now it works properly. The 2 min video gets compressed to 142 MB with acceptable quality.

Subject: avi compression in Windows 7

From: Michael

Date: 24 May, 2014 20:55:13

Message: 14 of 15

Regarding the FFDS codec, I had good success with it after a couple of false starts.

I was using MATLAB r2011a 32-bit on a Win7 64-bit machine. First I installed the 32-bit version of ffdshow, thinking it should match MATLAB's bit type. Nope! MATLAB said "can not find compressor". After installing the 64-bit version of ffdshow, it worked like a charm -- no need to restart MATLAB, reboot, or anything.

Using the code snippet from the OP, I saw a reduction from about 100 MB uncompressed to about 2 MB with the ffds codec. This is a huge benefit.

Note that the SourceForge page for ffdshow (http://sourceforge.net/projects/ffdshow/) is a bit out of date (2004), but there is a link on the page to an updated page with newer releases of the software (http://ffdshow-tryout.sourceforge.net/).

-Mike

Subject: avi compression in Windows 7

From: Noel

Date: 4 Aug, 2014 08:15:17

Message: 15 of 15

Though there are many Video Compressors, they either compress video in poor output quality or support few video formats.

This article just aims to introduce a powerful video compressor and a step by step guide on how to reduce the file size of various video with almost no loss of video quality at: http://www.faasoft.com/articles/video-compressor.html

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