Compress an existing AVI file?

I have an AVI file which I want to be able to open and compress and then resave.

The purpose of this is to be able to take an uncompressed AVI file and compress with various options to compare file sizes.

I am familiar with reading in AVI streams, but am uncertain on how to take existing uncompressed streams and compress them.

Thanks,

Don
dmetzlerAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
chensuConnect With a Mentor Commented:
When you use the AVISave function, pass the AVICOMPRESSOPTIONS structure containing the compression options. The AVISave function in turn uses the AVIMakeCompressedStream function.
0
 
dmetzlerAuthor Commented:
So, basically, read in all the streams and then write them out to a new file with the AVICOMPRESSOPTIONS structure set?
0
 
chensuCommented:
Right.
0
Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

 
dmetzlerAuthor Commented:
Thanks...
0
 
dmetzlerAuthor Commented:
Chensu,

I have my AVI streams loaded (2, actually - one DIB image and one WAV stream).  If I try to manipulate the fccHandler to 'MSVC' then the AVISaveV() function fails.

Where can I details about the results of a AVISaveV() failure?

Now - if I use the AVISaveOptions() function and select "Microsoft Video 1" then the compression is valid in the file (though the single image frame AVI does not change size from the original).

Can you help?

Thanks,

Don
0
 
chensuCommented:
// From vfw.h, hope this helps.

#ifndef AVIERR_OK
#define AVIERR_OK               0L

#define MAKE_AVIERR(error)      MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x4000 + error)

// !!! Questions to be answered:
// How can you get a string form of these errors?
// Which of these errors should be replaced by errors in SCODE.H?
#define AVIERR_UNSUPPORTED      MAKE_AVIERR(101)
#define AVIERR_BADFORMAT        MAKE_AVIERR(102)
#define AVIERR_MEMORY           MAKE_AVIERR(103)
#define AVIERR_INTERNAL         MAKE_AVIERR(104)
#define AVIERR_BADFLAGS         MAKE_AVIERR(105)
#define AVIERR_BADPARAM         MAKE_AVIERR(106)
#define AVIERR_BADSIZE          MAKE_AVIERR(107)
#define AVIERR_BADHANDLE        MAKE_AVIERR(108)
#define AVIERR_FILEREAD         MAKE_AVIERR(109)
#define AVIERR_FILEWRITE        MAKE_AVIERR(110)
#define AVIERR_FILEOPEN         MAKE_AVIERR(111)
#define AVIERR_COMPRESSOR       MAKE_AVIERR(112)
#define AVIERR_NOCOMPRESSOR     MAKE_AVIERR(113)
#define AVIERR_READONLY            MAKE_AVIERR(114)
#define AVIERR_NODATA            MAKE_AVIERR(115)
#define AVIERR_BUFFERTOOSMALL      MAKE_AVIERR(116)
#define AVIERR_CANTCOMPRESS      MAKE_AVIERR(117)
#define AVIERR_USERABORT        MAKE_AVIERR(198)
#define AVIERR_ERROR            MAKE_AVIERR(199)
0
 
dmetzlerAuthor Commented:
Yes - I am familiar with those, but the return code is a rather large number (something like 250938793 as a DWORD).

Will get exact results and post them.
0
 
dmetzlerAuthor Commented:
Chensu,

The exact result from AVISaveV() is: 2147762289 (DWORD).
0
 
chensuCommented:
That is AVIERR_NOCOMPRESSOR, meaning that you don't have that CODEC installed.

AVIERR_NOCOMPRESSOR is MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x4000 + 113) instead of 113.
0
 
dmetzlerAuthor Commented:
Thanks...guess I need to look at the MAKE_SCODE macro.

Don
0
All Courses

From novice to tech pro — start learning today.