delphiscreenshotdspack

How to get a Frame Bitmap from a Video File by DsPack Components?


Is it possible to get a bitmap from a video file by DsPack components?

In this case I'm using this code; but It can't take a screenshot Image:

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;

Is it possible to Fix This code?


Solution

  • after a while I found a sample for solving this problem:

    we can use "SnapShot.dpr". this is a sample which distributed with DsPack Components.