0

是否可以通过 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;

是否可以修复此代码?

4

1 回答 1

1

过了一会儿,我找到了解决此问题的示例:

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

于 2012-10-15T18:50:03.867 回答