PDA

View Full Version : Delphi: Video frames to bitmaps? (SXMedia install help!)



AJA
24-05-2006, 03:22 PM
Hi,

I guess this is not quite the correct forum for this but I've googled for almost an hour and haven't found any delphi programming forums. This is also pretty urgent (it's for a game competition which ends on sunday) so I appreciate it a lot if you can help me.

This delphi project is actually a plugin for AdventureGameStudio. What I'm trying to achieve is to play an Avi file (compressed with DivX) outputting it onto a screen bitmap (TBitmap, 640x400). Can this be done using the TMediaPlayer component or perhaps the VideoLab components (I can't figure out how to use them without the graphical ide)? The bitmap will then be passed on to the game engine which draws it onto the screen.

Thanks for any help!

-edit-
Oh, and I'm pretty much a beginner with this sort of stuff. I've made programs in delphi but that's easy when you can use the graphical ide.

technomage
24-05-2006, 04:15 PM
Hi and Welcome

There are a number of ways to do this.

The SXMedia (http://www.cerebral-bicycle.co.uk/viewdoc.asp?doc=157) Components renders any movie using DirectShow and DirectX (the components use DelphiX) so you could base some of your code on that, and just capture each frame to a bitmap.

There are probably some avi.pas units around somewhere (I think I have one) tht will allow you to get a bitmap image from the avi file. IF I can find that I will post it (no promises though as I wrote that code about 10 years ago).

Dean

AJA
24-05-2006, 06:21 PM
I wasn't able to install SXMedia (required package 'vcl30' not found). I don't think DelphiX was installed properly either. I'm using Delphi 2005, by the way.

I have no idea what to try next. VideoLab components didn't work. They just crashed the game or maybe I was just doing something wrong.

Help... :(

-edit-
And if I just remove the requires, I get the error "File not found: 'dsgnintf.dcu'"

technomage
24-05-2006, 07:29 PM
Just remove the refernece to vcl30 and it will automatically pick up the correct packages. :-)

That package was developed in Delphi 3 soyou will definately need to modify the pgk file.

AJA
24-05-2006, 08:03 PM
Okay, I guess that's sorted out now. But I still get these errors:
[Error] DShow.pas(1897): E2003 Undeclared identifier: 'DDSURFACEDESC'
[Error] DShow.pas(2630): E2003 Undeclared identifier: 'DDCAPS'
[Error] DShow.pas(3011): E2003 Undeclared identifier: 'DDPIXELFORMAT'
[Error] DShow.pas(3279): E2003 Undeclared identifier: 'DDCOLORCONTROL'

There must be some library or something still missing?

Clootie
25-05-2006, 04:02 AM
Seems you need a DirectDraw.pas (or DDraw.pas ?) compatible with your DShow unit.

AJA
26-05-2006, 02:42 PM
Okay, I it should work now. When I compile SXMedia, it says it will add DelphiX90. But when I click ok delphi highlights the requires line "DelphiX90" and gives this error message:
[Error] SXM.dpk(31): E2399 Namespace conflicts with unit name '(null)'

What do I do?

fragle
26-05-2006, 10:33 PM
I'd like to ask - do you need just to show your video in some rectangle, or would you want to be able to capture every frame shown (hence the TBitmap thing)? Or is it neither and you want to show video on some surface (side of a cube say..)? Now i'm kind of uncertain whether i could be of any use to you or not, 'cause i don't know which one of these you're trying to achieve :wink:

AJA
27-05-2006, 02:21 AM
Well, what I want to do is to play a video file one frame at a time and convert that frame into a PBitmap which is then forwarded to the AGS engine and it draws the bitmap onto the screen. This is supposed to be a plugin. :wink:

One problem with all this is that it might not be fast enough to play the video in real time.

dollavon
01-06-2006, 06:19 AM
To Aja¬£¬?

Please provide the download address of SXMedia Components.

Http://Www.cerebral-bicycle.co.uk Is unable to visit¡£If is convenient£¬Please send the Components to : dollavon@263.net. Thx

savage
01-06-2006, 08:13 AM
Please provide the download address of SXMedia Components.Thx

The full ]http://www.cerebral-bicycle.co.uk/viewdoc.asp?doc=157[/url].

Maybe it was down temporarily.

technomage
01-06-2006, 09:06 AM
We are looking into the problem, might take a while though...:(

AJA
01-06-2006, 09:52 AM
Okay, thanks, no hurry :wink:

dollavon
01-06-2006, 10:21 AM
Please provide the download address of SXMedia Components.Thx

The full ]http://www.cerebral-bicycle.co.uk/viewdoc.asp?doc=157[/url].

Maybe it was down temporarily.

To savage
http://www.cerebral-bicycle.co.uk/viewdoc.asp?doc=157 Is unable to visit¡£If is convenient£¬Please send the Components to : dollavon@263.net. Thx