Link to home
Start Free TrialLog in
Avatar of menorcanet
menorcanetFlag for Spain

asked on

Video Code: installed ?

How can I get a list of video codecs installed
on the system to check if codec whatever is
installed ? (any version of it)

Thanks
Avatar of freshman3k
freshman3k

Hello

First download Delphi import unit for the VFW SDK(you need to include this unit) in order the functions ICInfo,ICGetInfo and ICOpen to be available:

http://www.torry.net/vcl/mmedia/video/vfw.zip

And here is code how to get the list of codecs:
 
procedure TForm1.Button1Click(Sender: TObject);
var
  Count: Integer;
  Info: TICInfo;
  ic: HIC;
begin
ListBox1.Items.Clear;
Count:=0;
repeat
  if not ICInfo(0,Count,Info) then
    Break;
  ic:=ICOpen(Info.fccType,Info.fccHandler,ICMODE_QUERY);
  ICGetInfo(ic,Info,SizeOf(Info));
  ICClose(ic);
 
  ListBox1.Items.Add(Info.szDescription);
 
  Inc(Count);
until
  false;
end;

Good Luck :-)
I use DirectShow :)

great DirectShow components are DSPack at www.progdigy.com

and a standalone example:

function CodecInstalled(const CodecName: string): Boolean;
const
  IID_IPropertyBag: TGUID = '{55272A00-42CB-11CE-8135-00AA004BB851}';

var
  SysDevEnum: ICreateDevEnum;
  EnumCat: IEnumMoniker;
  Moniker: IMoniker;
  PropBag: IPropertyBag;
  varName: OleVariant;
  n: integer;
  s: string;
begin
  Result:=false;
  if (CoCreateInstance(CLSID_SystemDeviceEnum, nil, CLSCTX_INPROC, IID_ICreateDevEnum, SysDevEnum) = S_OK) then
  begin
    if (SysDevEnum.CreateClassEnumerator(CLSID_VideoCompressorCategory, EnumCat, 0)= S_OK) then
      while EnumCat.Next(1, Moniker, nil) = S_OK do
      begin
        if (Moniker.BindToStorage(nil, nil, IID_IPropertyBag, PropBag) = S_OK) and (PropBag<>nil) then
        begin
          PropBag.Read('FriendlyName', varName, nil);
          s:= varName;
          if AnsiCompareText(s, CodecName) = 0 then
          begin
            Result:=true;
            break;
          end;
        end;
      end;
  end;
end;
interested
you can also check for audio codecs with CLSID_AudioCompressorCategory .. you can enumerate lots of things this way
check out DirectShow.pas :) and the MSDN
Avatar of menorcanet

ASKER

freshman I get an error in the vfw unit..

function    ICQueryAbout(hic: HIC): BOOL;
begin
    Result := ICSendMessage(hic, ICM_ABOUT, -1, ICMF_ABOUT_QUERY) = ICERR_OK;
end;

Constant Expression violates subrange bounds

here too

function    MCIWndHome(hwnd: HWND): DWORD;
begin
    Result  := MCIWndSeek(hwnd, MCIWND_START);
end;

------

I'd rather use VFW than DirectShow, this way my app will
work even on win95 without Directx

Thanks.
Hello!

I found out that the link to the unit that I gave you will work for delphi 3 ,so if you use delphi 4,5,6 you need to download the following instead:

ftp://delphi-jedi.org/api/vfw.zip

This unit is modified to work with delphi 4,5,6  

Good luck! ;-)

still doesn't work :( it says
Incompatible types: TICNFO and PICINFO

then I changed the var ticinfo by picinfo then
it raises an exception when i click the button.

Can you tell me what the exception says please?




Can you tell me what the exception says please?



ASKER CERTIFIED SOLUTION
Avatar of freshman3k
freshman3k

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Manuel Lopez-Michelone
I found this browsing the www:

From: Peter Haas <PeterJHaas@t-online.de>
Newsgroups: borland.public.delphi.graphics
Subject: Re: Help with Video Capture CODEC Selection


Hi Alan,

Alan Miller wrote in <3B258A89.7D0C6291@san.rr.com>:
> I'm fairly new at this video world but I am amazed that I can find no
> examples of an application doing video cam capture that doesn't use a
> popup window from wfw of which i don't have the source of course.  In
> other words all the components and examples actually calls this in the
> wfw.pas file:
>
> function capDlgVideoCompression(hwnd:THandle):boolean;
> begin
>  Result := boolean(SendMessage(hwnd, WM_CAP_DLG_VIDEOCOMPRESSION, 0,
> 0));
> end;

This is the a documented and easy way to choose and initialize all
usefully properties.


> This brings up a list of available codecs that the user can select
> from.  However, since that window is controlled from within windows, I
> need an example to get the ICinfo on the codecs available to the system
> that my app can pick from, (ie. mpeg-4) instead of it always choosing
> the default AVI output which is a huge file believe me.  I looked up all
> the win sdk info on icinfo and icchoose etc. and i just can't seem to
> make it work.

There is a undocumented way, you can find a list of the installed codecs
in the registry:

On my computer (Win98SE, german) I have found the entries on:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\MediaResources\icm

The relevant codes will begin with vidc. See in the WinSDK for another
FOURCC's and more infos:
http://msdn.microsoft.com/library/default.asp?URL=/library/psdk/multimed/avicomp_7bar.htm

Bye Peter.



Hope this helps,
best regards,

manuel lopez (lopem)
lopem, that branch doesn't exist in Windows XP,
"Media" is missing from here "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control"

freshman it works now, big thanks.