menorcanet
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
on the system to check if codec whatever is
installed ? (any version of it)
Thanks
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- 00AA004BB8 51}';
var
SysDevEnum: ICreateDevEnum;
EnumCat: IEnumMoniker;
Moniker: IMoniker;
PropBag: IPropertyBag;
varName: OleVariant;
n: integer;
s: string;
begin
Result:=false;
if (CoCreateInstance(CLSID_Sy stemDevice Enum, nil, CLSCTX_INPROC, IID_ICreateDevEnum, SysDevEnum) = S_OK) then
begin
if (SysDevEnum.CreateClassEnu merator(CL SID_VideoC ompressorC ategory, 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;
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-
var
SysDevEnum: ICreateDevEnum;
EnumCat: IEnumMoniker;
Moniker: IMoniker;
PropBag: IPropertyBag;
varName: OleVariant;
n: integer;
s: string;
begin
Result:=false;
if (CoCreateInstance(CLSID_Sy
begin
if (SysDevEnum.CreateClassEnu
while EnumCat.Next(1, Moniker, nil) = S_OK do
begin
if (Moniker.BindToStorage(nil
begin
PropBag.Read('FriendlyName
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_AudioCompressorCateg ory .. you can enumerate lots of things this way
check out DirectShow.pas :) and the MSDN
check out DirectShow.pas :) and the MSDN
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.
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! ;-)
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! ;-)
ASKER
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I found this browsing the www:
From: Peter Haas <PeterJHaas@t-online.de>
Newsgroups: borland.public.delphi.grap hics
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(hwn d:THandle) :boolean;
> begin
> Result := boolean(SendMessage(hwnd, WM_CAP_DLG_VIDEOCOMPRESSIO N, 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\ CurrentCon trolSet\Co ntrol\Medi aResources \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)
From: Peter Haas <PeterJHaas@t-online.de>
Newsgroups: borland.public.delphi.grap
Subject: Re: Help with Video Capture CODEC Selection
Hi Alan,
Alan Miller wrote in <3B258A89.7D0C6291@san.rr.
> 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(hwn
> begin
> Result := boolean(SendMessage(hwnd, WM_CAP_DLG_VIDEOCOMPRESSIO
> 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\
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)
ASKER
lopem, that branch doesn't exist in Windows XP,
"Media" is missing from here "HKEY_LOCAL_MACHINE\System \CurrentCo ntrolSet\C ontrol"
freshman it works now, big thanks.
"Media" is missing from here "HKEY_LOCAL_MACHINE\System
freshman it works now, big thanks.
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
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,In
ICGetInfo(ic,Info,SizeOf(I
ICClose(ic);
ListBox1.Items.Add(Info.sz
Inc(Count);
until
false;
end;
Good Luck :-)