Witam, czy ktos dysoponuje jakims kodem dzieki ktoremu mozna wyciagnac info z pliku *.avi czyli np: kodek, rozdzialka itd.
Znalazlem fajny kod na torry.net ale za bardzo nie wiem o co w nim chodzi =/ wiec plz o jakas pomoc...
0
0
nie pamietam skad:
(istotne info masz w zmiennych)
mam nadzieje, ze sie przyda
type
FourCC=array[1..4]of char;
TDVINFO = record
dwDVAAuxSrc : FourCC;
dwDVAAuxCtl : LongInt;
dwDVAAuxSrc1 : FourCC;
dwDVAAuxCtl1 : FourCC;
dwDVVAuxSrc : LongInt;
dwDVVAuxCtl : FourCC;
dwDVReserved1 : FourCC;
dwDVReserved2 : LongInt;
end;
TAVIMainHeader = record
MicroSecPerFrame : LongInt;
MaxBytesPerSec : LongInt;
PaddingGranularity : LongInt;
Flags : LongInt;
TotalFrames : LongInt;
InitialFrames : LongInt;
Streams : LongInt;
SuggestedBufferSize : LongInt;
Width : LongInt;
Height : LongInt;
Scale : LongInt;
Rate : LongInt;
Start : LongInt;
Length : LongInt;
end;
TAviUnknownRecord=record
f1:Longint;
f2:LongInt;
f3:Longint;
f4:FourCC;
f5:LongInt;
end;
TsecondAvi=record
FType:FourCC;
Handler:FourCC;
Flags:Longint;
Reserved1:Longint;
InitialFrames:Longint;
Scale:Longint;
Rate:Longint;
Start:Longint;
Length:Longint;
SuggestedBufferSize:Longint;
Quality:Longint;
SampleSize:Longint;
end;
var
oTime:TDatetime; //czas filmu
oWidth:integer; //szerokosc
oHeight:integer; //wysokosc
oTotalFrames:integer; //ilosc klatek
oHandler1:FourCC; //uchwyty - olac
oHandler2:FourCC; //uchwyty - olac
oFilesize:longword; //rozmiar pliku
oCodec:string; //nazwa kodeka
oStringTime:string; //czas filmu - postac HH:MM:SS
ofps: double; //fps
function getCodec(id2:string):string;
begin
getcodec:='Unknown';
if (id2='DIV3') then getcodec:='DivX 3 Low-Motion';
if (id2='DIV4') then getcodec:='DivX 3 Fast-Motion';
if (id2='DIVX') then getcodec:='DivX 4';
if (id2='DX50') then getcodec:='DivX 5.0';
if (id2='XVID') then getcodec:='XviD';
if (id2='MP41') then getcodec:='MS Mpeg-4 V1';
if (id2='MP42') then getcodec:='MS Mpeg-4 V2';
if (id2='MP43') then getcodec:='MS Mpeg-4 V3';
if (id2='IV32') then getcodec:='Indeo 3.2';
if (id2='IV33') then getcodec:='Indeo 3.3';
if (id2='IV34') then getcodec:='Indeo 3.4';
if (id2='IV35') then getcodec:='Indeo 3.5';
if (id2='IV36') then getcodec:='Indeo 3.6';
if (id2='IV37') then getcodec:='Indeo 3.7';
if (id2='IV38') then getcodec:='Indeo 3.8';
if (id2='IV39') then getcodec:='Indeo 3.9';
if (id2='IV41') then getcodec:='Indeo Interactive';
end;
function Execute(filename:string):integer;
var
AVI : TAVIMainHeader ;
DVINFO : TDVINFO ;
unknownR:TaviUnknownrecord;
avi2:TsecondAvi;
F : File;
t:double;
g,m,s:string;
begin
otime:=0;
oWidth:=0;
oHeight:=0;
oTotalFrames:=0;
oHandler1:=' ';
oHandler2:=' ';
oFilesize:=0;
ocodec:='Unknown';
if not fileexists(FileName)then
begin
oerror:=1;
Execute:=1;
exit;
end;
AssignFile(F, FileName);
filemode:=0;
Reset(F,1);
BlockRead(F, DVINFO, SizeOf(DVINFO));
if uppercase(DVINFO.dwDVAAuxSrc)<>'RIFF' then
begin
oerror:=2;
Execute:=2;
exit;
end;
if uppercase(DVINFO.dwDVAAuxSrc1)<>'AVI ' then
begin
oError:=2;
Execute:=2;
exit;
end;
//system.filesize(f);
BlockRead(F, AVI, SizeOf(AVI));
Blockread(f, UnknownR, Sizeof(unknownR));
Blockread(F, avi2, sizeof(avi2));
oFileSize:=system.filesize(f);
Blockread(f, UnknownR, Sizeof(unknownR));
Blockread(f, UnknownR, Sizeof(unknownR));
owidth:=avi.Width;
oheight:=avi.Height;
oTotalFrames:=avi2.Length;
ofps:=avi2.Rate / avi2.Scale;
t:=round(avi2.Length div(avi2.Rate / avi2.Scale));
g:=inttostr(t div 3600);
m:=inttostr((t-(strtoint(g)*3600)) div 60);
s:=inttostr(t mod 60);
if length(g)=1 then g:='0'+g;
if length(m)=1 then m:='0'+m;
if length(s)=1 then s:='0'+s;
oStringTime:=g+':'+m+':'+s;
oTime:=strtotime(ostringtime);
ohandler1:=avi2.Handler;
ohandler2:=Unknownr.f4;
oCodec:=getCodec(ohandler2);
CloseFile(F);
execute:=0;
end;
//zonk byl, t:integer powinno byc double, juz poprawilem.
hehe, tak to jest jak sie kodzik przerabia na sucho :D
0
t:=Round(avi2.Length div(avi2.Rate / avi2.Scale));
w tym miejscu daje blad :
Operator not applicable to this operand type
ee i o co tu chodzi z tym bledem ??
Btw. dzieks na kod
//
DZIENKOWAC DZIENKOWAC D ALL DOES WORK [browar]
0
mr.hex napisał(a)
t:=Round(avi2.Length div(avi2.Rate / avi2.Scale));
w tym miejscu daje blad :
Operator not applicable to this operand type
try:
t:=Round(avi2.Length div(avi2.Rate div avi2.Scale));