如何通过DsPack组件从视频文件中获取帧位图?

时间:2012-10-15 10:44:11

标签: delphi screenshot dspack

是否可以通过DsPack组件从视频文件中获取位图?

在这种情况下,我正在使用此代码;但它无法截取图片:

type
  TForm4 = class(TForm)
    FilterGraph1: TFilterGraph;
    VideoWindow1: TVideoWindow;
    btnPlay: TButton;
    SampleGrabber1: TSampleGrabber;
    btnTakePicture: TButton;
    Image1: TImage;
    procedure btnPlayClick(Sender: TObject);
    procedure btnTakePictureClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

...

procedure TForm4.btnPlayClick(Sender: TObject);
begin
  SampleGrabber1.FilterGraph := FilterGraph1;
  VideoWindow1.FilterGraph := FilterGraph1;
  FilterGraph1.Active := true;
  FilterGraph1.RenderFile('C:\TEMP\1.mp4');
  FilterGraph1.Play;
end;

procedure TForm4.btnTakePictureClick(Sender: TObject);
begin
  SampleGrabber1.GetBitmap(Image1.Picture.Bitmap);
end;

是否可以修复此代码?

1 个答案:

答案 0 :(得分:1)

过了一会儿,我发现了一个解决这个问题的样本:

我们可以使用“SnapShot.dpr”。这是与DsPack组件一起分发的示例。