|
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...
|
|
|
|
|
1. Thanks - now I know what @ does (I added it before posting that message. I always use \\.
The problem was found by myself - lOl.
I had a problem with Initialise method, but I solved the problem and now It works fine.
Thanks for help anyway
|
|
|
|
|
Will this work on Xbox360 too?
|
|
|
|
|
I have not tested the class on the XBox 360 (Since I don't own one...), but it would be interesting to try it. It does use the "Third-Party" DirectShowLib-2005.dll, which may be a problem (or not, since it is Managed code). Anyway, there is no harm in giving it a try! Please let me know how you make out, if you do decide to experiment.
|
|
|
|
|
I dont own Xbox360 too, and thats why I'm asking.
|
|
|
|
|
Thanks for sharing this. This will definitely help with some future projects I have planned.
|
|
|
|
|
Gr8 article.
Can anyone provide me url where to find sourcecode for compressing and uncompressing video frame with H.264 algorithm.
Thank you.
|
|
|
|
|
|
Due to popular demand I have extended the VideoTexture class to now consume .avi, .mpeg, .wmv video clips as well as live video. This update has been sent to CodeProject today (30 July 2007), and should be available in a couple of days. Thanks to alexreg for his assistance and encouragement.
|
|
|
|
|
Great job with this... it seems to be working for me (although it actually displays from my TV tuner, since I don't have a web cam), and the code is well structured and documented. I'm be really keen to see if you'll produce a version of this that renders AVIs/MPEGs. This is something I'm desperate to include in my XNA game. Perhaps I'll play around with it, and let you know if I get it to play back video.
|
|
|
|
|
Thanks for your comments. I have had several people ask me about extending the class to play AVI's or MPEG files. This should be quite doable, and perhaps I will take a look at the problem this weekend. Cheers!
|
|
|
|