2009. február 27., péntek
How to extract an audio stream of an *.avi file
Problem/Question/Abstract:
How can I extract an audio stream of an *.avi file?
Answer:
Note, you must use VfW.pas. You may find this file somewhere in the internet or simply write me an email. In addition, I was not able to test this code under Delphi 5.x or lower. Only Delphi 6.x. Please send me a piece of information, if you can test this for me. Thanks
uses VfW;
function CallBack(i: int): BOOL; pascal;
begin
Label1.Caption := IntToStr(i) + '%';
Application.ProcessMessages;
Result := False;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
PFile: IAviFile;
PAvi: IAviStream;
plpOptions: PAviCompressOptions;
begin
AviFileInit;
if AviFileOpen(PFile, 'C:\test.avi', 0, nil) <> 0 then
begin
ShowMessage('Couldn'' t open * .avi!');
Exit;
end;
if AviFileGetStream(PFile, PAvi, StreamTypeAudio, 0) <> 0 then
begin
ShowMessage('Couldn' t load audio stream!');
AviFileExit;
Exit;
end;
if AviSaveV('C:\test.wav', nil, @CallBack, 1, PAvi, plpOptions) <> 0 then
begin
ShowMessage('Couldn'' t save * .wav - file!');
AviStreamRelease(PAvi);
AviFileExit;
Exit;
end;
AviStreamRelease(PAvi);
AviFileExit;
end;
Feliratkozás:
Megjegyzések küldése (Atom)
Nincsenek megjegyzések:
Megjegyzés küldése