如何实现视频文件的视频与音频分割?(50分)

  • 主题发起人 主题发起人 jog81
  • 开始时间 开始时间
J

jog81

Unregistered / Unconfirmed
GUEST, unregistred user!
我想做一个程序,可以将VCD等切割成视频和音频文件。
但不知道从何做起,请各位高手帮忙,谢谢!
 
先凑合看着,正准备写复合流分割的笔记呢.
procedure TMainForm.RewriteVideo(const SourceFileName,
DestFileName: string);
var
Builder: ICaptureGraphBuilder2;
Graph: IGraphBuilder;
FileSource: IBaseFilter;
Mux: IBaseFilter;
FileWriter: IFileSinkFilter;
MediaControl: IMediaControl;
MediaEvent: IMediaEvent;
PinEnum: IEnumPins;
Pin: IPin;
PinInfo: TPin_Info;
MediaType: TAM_Media_Type;

EVCode: Integer;
FileName: array [0..255] of WideChar;
R: Integer;
Res: HResult;
begin

CoCreateInstance(CLSID_CaptureGraphBuilder2, nil, CLSCTX_INPROC,
IID_ICaptureGraphBuilder2, Builder);

StringToWideChar(DestFileName, FileName, 256);
Builder.SetOutputFileName(MEDIASUBTYPE_Avi, FileName, Mux, FileWriter);

Builder.GetFiltergraph(Graph);

AddToROT(Graph, R);

StringToWideChar(SourceFileName, FileName, 256);
Graph.RenderFile(FileName, nil);

Mux.EnumPins(PinEnum);
Res:=PinEnum.Next(1, Pin, nil);
while Res=S_OKdo

begin

Pin.QueryPinInfo(PinInfo);
if PinInfo.dir=PINDIR_INPUT then

begin

Pin.ConnectionMediaType(MediaType);
if not SameGUID(MediaType.majortype, MediaType_Video) then

Pin.Disconnect
end;

Res:=PinEnum.Next(1, Pin, nil)
end;

PinEnum:=nil;

Graph.QueryInterface(IID_IMediaControl, MediaControl);
Graph.QueryInterface(IID_IMediaEvent, MediaEvent);

MediaControl.Run;
MediaEvent.WaitForCompletion(INFINITE, EVCode);
MediaControl.Stop;

RemoveFromROT(R);

MediaEvent:=nil;
MediaControl:=nil;
FileWriter:=nil;
Mux:=nil;
FileSource:=nil;
Graph:=nil;
Builder:=nil
end;

 
期待 Lee 大侠,
不过,,,能帮我先看看 http://www.delphibbs.com/delphibbs/dispq.asp?lid=1858247 吗?
我觉得 VMR 是很好的技术呀,怎么没有多人研究这个呢?
 
接受答案了.
 
后退
顶部