Solved

How to save a single frame from a movie?

Posted on 2001-08-15
5
179 Views
Last Modified: 2012-05-04
Not sure if this is possible or not....

i'm using the TMediaPlayer in my app to play movies (avi,mpeg).

is it possible to save a single frame from the movie playing ?

now i dont mean opening the file and grabbing a single frame since this will differ depending on movietype...

i was more interested in somehow saving the current frame shown in the assigned Tpanel.

i've tried to make the Canvas propery for Tpanel available but not really sure where to go from there... (was kinda expecting the "SaveToFile" functions to come with it... but since it didn't i'm kinda stuck)


/John
0
Comment
Question by:Arachnid
  • 2
5 Comments
 
LVL 21

Expert Comment

by:gemarti
Comment Utility
Well this doesn't work exactly the way you would expect unless you play the movie in ontop of the control but here is something to work with. Maybe you can perfect it.

Put an image, button and mediaplayer component on a form.

assign a movie to the media player and try this

procedure TForm1.Button1Click(Sender: TObject);
begin
  Image1.Canvas.CopyRect(Image1.ClientRect,Canvas,MediaPlayer1.DisplayRect);
  Image1.Picture.SaveToFile('c:\Test.bmp');
end;
0
 
LVL 21

Accepted Solution

by:
gemarti earned 200 total points
Comment Utility
{Here is one off of the Panel1}

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, MPlayer, ExtCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    MediaPlayer1: TMediaPlayer;
    Button1: TButton;
    Image1: TImage;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
 Image1.Canvas.CopyRect(Image1.ClientRect,Canvas,Panel1.BoundsRect);
 Image1.Picture.SaveToFile('c:\Test.bmp');
end;

end.


0
 

Expert Comment

by:bullen
Comment Utility
http://home.t-online.de/home/Thomas.Schwobe/list11.htm

This code can give You any frame (Image) in an AVI file. You nead VFW.pas (about 180kB) and set Your Compiler to read from the "lib\delphi2" directory (Ole2 from delphi2) works fine for D4,5,6.

bullen
0
 
LVL 26

Expert Comment

by:Russell Libby
Comment Utility
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept gemarti's comment as answer

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Thank you,
Russell

EE Cleanup Volunteer
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now