How to Bundle all required codec in the AVI module

Hi Experts,
I had developed the program that let user record a avi file.

I used vfw.h lib for AVI record and avi codecs option dialog to let user choose what the codecs option need to be used.

This dialog list all AVI codecs that had installed all the computer as MicroSoft Video codec 1, Cinepak,...
If I want to used a codecs as Dix6.1 codecs I have to install this as separate software.

My problem is when I used AVI codecs dialog by AVISaveOption this list all the system codecs and have some codecs not work and have some unnecessary codecs for my application.
In addition to  I must to install Dix or MPEG coecs as separate if I want to use this, this is not advance for my appliction.

So now, I want to ask you if we have any way to bundle all required codecs (as Dix, MPEG1, MPEG4, MS Video Codec 1) to my required codecs I mean I want to list this by my self with own pop up codecs dialog not using AVISaveOptions(hwnd, 0, 1, &m_pAviStream, (LPAVICOMPRESSOPTIONS FAR *) &aopts)  to list and choose the codecs option.

Thanks in advance






CongUanAsked:
Who is Participating?
 
Dariusz DziaraConnect With a Mentor ProgrammerCommented:
"using a own pop up dialog." - I think that it is impossible. Note that AVICOMPRESSOPTIONS structure has lpParam member which is "Video-compressor specific data". Hence I cannot image creating own dialog and filling this structure manually.
0
 
Dariusz DziaraProgrammerCommented:
This is only idea:

It is possible to list VCM codecs using DirectShow.

CoCreateInstance(CLSID_SystemDeviceEnum, ..., (void **)&pSysDevEnum)

and then

pSysDevEnum->CreateClassEnumerator(CLSID_VideoCompressorCategory, ...);

(see "Choosing a Compression Filter" topic in DirectShow doc)

I don't know if you can interface this with your code (can you use codec name ?).

0
 
CongUanAuthor Commented:
Hi,
I thank you for this, but I had not used DirectShow in this,

I used vfw to do record avi and choose the codecs option.

The below is some my codes:

if (FAILED(AVIFileOpen(&m_pAviFile, m_szFileName, OF_CREATE | OF_WRITE | OF_SHARE_EXCLUSIVE, NULL)))
      {
            strcpy(m_szErrorMessage, "SetCodecsOption(): Unable to Create the Movie File");
            goto TerminateInit;
      }
      
      ZeroMemory(&m_AviStreamInfo, sizeof(AVISTREAMINFO));
      m_AviStreamInfo.fccType = streamtypeVIDEO;
      m_AviStreamInfo.fccHandler=m_AviCodecsDefaultOpt.fccHandler;
      
      m_AviStreamInfo.dwScale = m_dwScale;
      m_AviStreamInfo.dwRate = m_dwRate;
      m_AviStreamInfo.dwQuality = 10000;                                                            //      max quality

      m_AviStreamInfo.dwSuggestedBufferSize = nMaxWidth*nMaxHeight*4;
    SetRect(&m_AviStreamInfo.rcFrame, 0, 0, bmpInfo.bmiHeader.biWidth, bmpInfo.bmiHeader.biHeight);
      strcpy(m_AviStreamInfo.szName, "Video Stream");
      
      if (FAILED(AVIFileCreateStream(m_pAviFile, &m_pAviStream, &m_AviStreamInfo)))
      {
            strcpy(m_szErrorMessage, "SetCodecsOption(): Unable to Create Stream");
            goto TerminateInit;
      }
      
      ZeroMemory(&m_AviCompressOptions, sizeof(AVICOMPRESSOPTIONS));
      memcpy(&m_AviCompressOptions,&m_AviCodecsDefaultOpt,sizeof(AVICOMPRESSOPTIONS));

      if (!AVISaveOptions(hwnd, 0, 1, &m_pAviStream, (LPAVICOMPRESSOPTIONS FAR *) &aopts))
      {
            AVISaveOptionsFree(1,(LPAVICOMPRESSOPTIONS FAR *) &aopts);
            goto TerminateInit;
      }

I used AVISaveOptions to list all the codecs in system
But have some codecs don't need to use because it not work with AVI, and for more advance, I need bundle some codecs as Dix, MPEG1, or MPEG4 to my codecs.
So I want to ask you if we can bundle codecs as Dix, MPEG1,... as own codecs with using a own pop up dialog.
Please explain more if you can
Thank in advance!

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.