哪位高手可以帮我修改一下下面的代码,帮我实现 从mpg 文件到 asf 文件的转换,
如果有别的 delphi 源代码,也可以,谢谢unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleServer, WMEncoderLib_TLB;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
wmencoder1: wmencoder;
implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
srcgrpcoll:iwmencsourcegroupcollection;
srcgrp:iwmencsourcegroup;
srcaud:iwmencaudiosource;
srcvid:iwmencvideosource;
procoll:iwmencprofilecollection;
sfile:iwmencfile;begin
wmencoder1:=cowmencoder.Create;
srcgrpcoll:=wmencoder1.SourceGroupCollection;
srcgrp:=srcgrpcoll.Add('sg_1');
sfile:=wmencoder1.File_;
sfile.LocalFileName:='j:\cctv.asf';
wmencoder1.EnableAutoArchive:=true;
srcaud:=srcgrp.AddSource(emenc_audio);//这里出现类型不匹配,
srcvid:=srcgrp.addsource(wmenc_video);//同上
procoll:=wmencoder1.ProfileCollection;
srcgrp.set_Profile(procoll.Item(2));
srcvid.SetInput('j:\\cctv.mpg','','');//这里程序调试时没错,但运行时出错,在VB.net里面可以不用带后面的两个空参数,但如果delphi 中不带,就会提示参数不足
srcaud.SetInput('j:\\cctv.mpg','','');//同上
srcvid.Repeat_:=false;
srcaud.Repeat_:=false;
wmencoder1.PrepareToEncode(true);
wmencoder1.Start;
end;end.
如果有别的 delphi 源代码,也可以,谢谢unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleServer, WMEncoderLib_TLB;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
wmencoder1: wmencoder;
implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
srcgrpcoll:iwmencsourcegroupcollection;
srcgrp:iwmencsourcegroup;
srcaud:iwmencaudiosource;
srcvid:iwmencvideosource;
procoll:iwmencprofilecollection;
sfile:iwmencfile;begin
wmencoder1:=cowmencoder.Create;
srcgrpcoll:=wmencoder1.SourceGroupCollection;
srcgrp:=srcgrpcoll.Add('sg_1');
sfile:=wmencoder1.File_;
sfile.LocalFileName:='j:\cctv.asf';
wmencoder1.EnableAutoArchive:=true;
srcaud:=srcgrp.AddSource(emenc_audio);//这里出现类型不匹配,
srcvid:=srcgrp.addsource(wmenc_video);//同上
procoll:=wmencoder1.ProfileCollection;
srcgrp.set_Profile(procoll.Item(2));
srcvid.SetInput('j:\\cctv.mpg','','');//这里程序调试时没错,但运行时出错,在VB.net里面可以不用带后面的两个空参数,但如果delphi 中不带,就会提示参数不足
srcaud.SetInput('j:\\cctv.mpg','','');//同上
srcvid.Repeat_:=false;
srcaud.Repeat_:=false;
wmencoder1.PrepareToEncode(true);
wmencoder1.Start;
end;end.
相信你再调试调试应该会有答案的。
srcaud.SetInput('j:\\cctv.mpg','','');//同上我沒用過,但我想,你不要說這兒沒人.1.Delphi中的路徑使用單線;(多線我沒用過);
2.你閱讀清楚那個函數的參數以下.如果你留空不行的話,使用nil也許可以.或者.
你看是否需要unicode參數.別的我不知道了.我對應用曾知道很少,對系統層也知道不多.