Solved

How to save a single frame from a movie?

Posted on 2001-08-15
5
184 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 21

Expert Comment

by:gemarti
ID: 6389554
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
ID: 6390086
{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
ID: 6834343
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
ID: 8741881
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

688 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