|
Hi Lars;
For some unknown reason Codeproject is not allowing me to reply to your post today, hence this new post.
The size of the texture is set by inspecting the size of the source video. If you want to have a larger texture then you will need to change the output size from your webcam, if you webcam allows it.
Steve.
-- modified at 12:34 Thursday 11th October, 2007
|
|
|
|
|
This is really a nice little class.
Unfortuantely it only grabs pictures sized 320*240 on my Pc. Could you tell me how I could increase the resolution?
Greetings Lars
|
|
|
|
|
In order to integrate in my current project i have added Videotexture and videocomponent classes and referenced direcshowlib.
It compiles well.
I have added
TV = new VideoComponent(this);
this.Components.Add(TV);
in initialize method of game1.cs
and
TV.VideoTexture.Start(); (ive tried TV.VideoTexture.Run() also)
in the game1 update method
it compiles but is not showing anything.
(i am using a public static spritebatch declared in game1 in the video componet class not the videosprite spritebatch declared in videocomponent.
|
|
|
|
|
There are some arguments of wrong type
What version of directxlib should i use?
The binaries (xnaviewer.exe) does not work, it crashes too.The two dlls are in the same folder that the .exe.
I am trying to play an .avi there is no webcam installed. The final goal of the prject is play video from a TV card.
directxlib used:
v 2.0 - (2007-07-15)
Errors (in spanish sorry )
--------------------------------------------------------------
Error 4 La mejor coincidencia de método sobrecargado para 'DirectShowLib.IMediaEventEx.FreeEventParams(DirectShowLib.EventCode, System.IntPtr, System.IntPtr)' tiene algunos argumentos no válidos C:\Documents and Settings\XnaVideoProjectFiles\xnaVideoProjectFiles\xnaVideoLib\VideoTexture.cs 595 26 xnaVideoLibary
Error 2 Argumento '2': no se puede convertir de 'out int' a 'out System.IntPtr' C:\Documents and Settings\XnaVideoProjectFiles\xnaVideoProjectFiles\xnaVideoLib\VideoTexture.cs 570 70 xnaVideoLibary
Error 3 Argumento '3': no se puede convertir de 'out int' a 'out System.IntPtr' C:\Documents and Settings\XnaVideoProjectFiles\xnaVideoProjectFiles\xnaVideoLib\VideoTexture.cs 570 87 xnaVideoLibary
Error 4 La mejor coincidencia de método sobrecargado para 'DirectShowLib.IMediaEventEx.FreeEventParams(DirectShowLib.EventCode, System.IntPtr, System.IntPtr)' tiene algunos argumentos no válidos C:\Documents and Settings\XnaVideoProjectFiles\xnaVideoProjectFiles\xnaVideoLib\VideoTexture.cs 595 26 xnaVideoLibary
Error 5 Argumento '2': no se puede convertir de 'int' a 'System.IntPtr' C:\Documents and Settings\XnaVideoProjectFiles\xnaVideoProjectFiles\xnaVideoLib\VideoTexture.cs 595 71 xnaVideoLibary
Error 6 Argumento '3': no se puede convertir de 'int' a 'System.IntPtr' C:\Documents and Settings\XnaVideoProjectFiles\xnaVideoProjectFiles\xnaVideoLib\VideoTexture.cs 595 84 xnaVideoLibary
|
|
|
|
|
Answering myself :
//int eventParam1, eventParam2;
IntPtr eventParam1, eventParam2
------------------------------------------------------------
Now another question. I I connect a tv receiver card can i use yourcomponent to play video from it?
|
|
|
|
|
Answering myself again.
Yes it works
|
|
|
|
|
Hi Stephen
I posted many requests for several forums to get a component for streaming video in network.
I developed a software for a medical clinics. Doctors like to see Waiting Room.
My software installed in two computers. One in clerck's room and another in doctor's room and they work together. I connected webcam to clerck's computer and i want to send video to doctor's computer.
Is your code can help me about this. before i used MediaEncoder that it has delay and its not usefull.
Tanx
|
|
|
|
|
The VideoTexture class is not directly usable by a remote object because it is not a MarshalByRef object, and it depends upon a GraphicsDevice object that binds it to a specific context.
However, the source could be worked fairly easily into a remotable object that would, for example, pass width, height, and an array of colorData through an EventArg using a Client-Server model. The client could update a VideoTexture object using these arguments.
This sounds like a worthy extension, and I may do it if I have time. Unfortunately, I will be travelling for the next month and will not be able to consider it until I return in mid October.
Steve.
|
|
|
|
|
Hi mister,
any solution about it ? some code source please ?
Regards
AE
|
|
|
|
|
Esto no tira ni empujando
One word witch two different miniuns funy ingles
|
|
|
|
|
Me disculpo por mi español pobre. Si entiendo tu comentario, no puedes recibir el NewVideoTextureEvent cuando suscribes. ¿Es este correcto? ¿Se levanta una excepción?
|
|
|
|
|
Is it possible to play a movie file with voice synchronously in XNA?
|
|
|
|
|
I am sure that it can be done; however this project has not attempted to work with the audio tracks of the video files, which are simply ignored by the DirectShow filter graphs that I am using. If you use XACT to pull your sound files into the XNA project, then you would have to try to synchronize the audio and video yourself, I am afraid.
Steve.
|
|
|
|
|
Yes XACT could be used as an alternative but it would be great to use direct show to play the movie with audio anyway...
|
|
|
|
|
Hi,
I can't set the destination rectangle for Texture2D. Actualy the scene does not fit in the textures scale and also by default VideoTexture2D are rotated by 90 degrees. I have tested the component with a mpeg file.
Thanx for the great job though
|
|
|
|
|
Hi;
The VideoTexture2D and the Texture2D classes do not expose source or destination rectangles as such. However, if I understand your question correctly, you are asking about setting the destination rectangle for the sprite that is rendered by the Draw() call in the VideoComponent class. To do this, you can set the DestinationRectangle property of the VideoComponent, and this will change where the sprite is drawn on the screen. By changing the SourceRectangle property of the VideoComponent you can select a sub-region of the source video to display, which can change the apparent scaling. Different choices of source and destination rectangles will obviously change the scaling and appearance of the video as it is rendered on the sprite. Similiarly, you can change the SpriteFlip property of the VideoComponent class to ensure that the video is rotated and flipped properly for you. Hope this helps.
Steve.
|
|
|
|
|
|
when i try to open the project demo I had this error message :"....cannot open this project. the porject type is not supported by this installation" ( PC configuration: Windows XP, MS visual studio 2005 version 8 and framwork version2)
Thanks a lot
|
|
|
|
|
Hi!
This project is a Microsoft XNA Game Studio Express project, which uses the XNA library and is intended to be used within the Microsoft Visual Studio Express C# environment (a free download that is well worth checking out!). XNA is Microsoft's new game development software that allows a programmer to write games that will work on both the PC and the XBox 360. For reasons of their own, they have decided to only support XNA on the Express Version of Visual Studio, and so there are some differences in the project and solution files that make them incompatible with Visual Studio 2005 Professional, for example. This is not an insurmountable problem, and there are ways to make this project work just fine within Visual Studio 2005 Professional; however, I would encourage you to go ahead and download the Express version and XNA and use it the way Microsoft built it to be used. People are building amazing games with this technology, just using the free downloads. I have the full blown version of Visual Studio 2005 with all the bells and whistles myself, and I am using XNA within it. However, this project is build just using the free tools, for other developers who are using them as well.
To find out all about XNA, and to get links to all the necessary downloads, you can check out: http://creators.xna.com/[^]
Cheers!
|
|
|
|
|
Hello,
A few hours ago I got a xnaVideoLibrary ( http://www.codeproject.com/csharp/VidTextureClassWebcamApp.asp ), added dlls, wrote some code and compiled as well.
Now, when I run I get my game crush. Debugger gives me this error:
An unhandled exception of type 'System.Exception' occurred in xnaVideoLibrary.dll
Additional information: Unable to Load Webcam Component.
Any ideas?
|
|
|
|
|
Im not trying to connect a webcam, but to play a movie.
private VideoComponent movie;
movie = new VideoComponent(this, "Content\\Video\\splash");
and
Components.Add(this.movie);
Hope you can help me
|
|
|
|
|
Hi Jan;
The constructor expects the extension (.avi, .mpeg, .wmv) to be present in the videoFile string, since it has to handle the file differently depending upon which type of format is being used. For example:
movie = new VideoComponent(this,@"Content/Video/splash.avi");
Also, make sure the path is relative to the directory where the executable for the application is running.
|
|
|
|
|
Hi Jan;
The exception that you refer to is thrown by the Constructor for the VideoTexture class, caught in the VideoComponent class, and rethrown for the application to handle. The message that you are getting is from the VideoComponent class, but there will be more information about the specific reason for the exception in the InnerException. For many (but not all) of the possible reasons for failure there may also be console messages that are generated, so you might want to watch for those. For example, there will be console messages if the program is unable to enumerate a camera on your system (if you are trying live video), if it is being asked to play a video file format that is not supported, if it is unable to create the DirectShow Filter Graph for some reason, or if there is some other error while trying to use a DirectShow method. If checking out the inner exception doesn't answer your question, please let me know.
|
|
|
|
|
Ive checked all (solution explorer, release directory and everything seems to be fine. I stil get this:
An unhandled exception of type 'System.Exception' occurred in xnaVideoLibrary.dll
Additional information: Unable to Load Webcam Component.
I have:
movie = new VideoComponent(this, @"Content\\Video\\splash.wmv");
Components.Add(this.movie);
which error is caused by.
Any ideas?
|
|
|
|
|
You are using the string literal (@) and escaped characters \\ in the same string.
Try:
movie = new VideoComponent(this,@"Content\Video\splash.wmv");
Also, just to confirm, are you sure that you have your "Content" directory under your \xnaVideoViewer\bin\x86\Release directory like this:
\xnaVideoViewer\bin\x86\Release\Content\Video\splash.wmv
Just to make sure the program can find your .wmv file, you could use an absolute address string like this:
"C:\Code\XnaVideo\\xnaVideoProjectFiles\xnaVideoViewer\bin\x86\Release\Content\Video\splash.wmv" for your videoFile parameter.
Also, as a test, you could put your splash.wmv file in your release directory, and use:
movie = new VideoComponent(this,"splash.wmv");
If that does not work then we might have to dig deeper, and see what the inner exception says...
|
|
|
|