Link to home
Start Free TrialLog in
Avatar of Arachnid
Arachnid

asked on

How to save a single frame from a movie?

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
Avatar of gemarti
gemarti
Flag of United States of America image

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;
ASKER CERTIFIED SOLUTION
Avatar of gemarti
gemarti
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bullen
bullen

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
Avatar of Russell Libby
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