Sign in to follow this  
niazware

Showing a movie in game

Recommended Posts

hi everybody I've a question about playing movies in game, I'm working on my game, and I'm going to finish it soon, what's the best way for showing a movie (MPG file) in game? I've implemented VMR, but isn't there anything more straight forward? what do you suggest for playing this movie? any source code, tips or tricks? thanks in advance

Share this post


Link to post
Share on other sites
Ehm...Directshow? I don't know much about it but you can play mp3's and avi's with it, and probably mpg's too then ;)

-Stenny

Share this post


Link to post
Share on other sites
Yeah, DirectShowNet did the job for me. There are great samples that show how to draw videos for example on texture and then show the texture on something. I got the most help from vmr9/VMR9Allocator2 sample that can be found from source below.

http://directshownet.sourceforge.net/ -> Downloads -> Download the samples

There is just one problem with that atm, I can't get the device recovered when using videos. The sample didn't explain how to revover the device... :/

Share this post


Link to post
Share on other sites
This depends on what you want to do.

1. If you are displaying full-screen video, or video over a section of the screen then just use the VMR in Windowless Mode, you can find information on this on MSDN.

With fullscreen I ran into some weird issues if you have more than one DirectShow graph present, so watch out for that. Also, having DivX codecs installed can often mess with the VMR, so get rid of these if necessary.

2. If you are displaying video onto a texture in a game, then you can take one of two routes. The first is to use the Sample Grabber, you can find a pretty good description of how to do this if you search this forum way back in the beginning of 2005.

The second route is to use a Custom Allocator-Presenter which is related to the VMR9, I have not tested this, but it is the 'new' method.

If you need to be brought up to speed on DirectShow in general then you should check these three excellent articles over on the Flipcode archive.

http://www.flipcode.com/articles/article_directshow01.shtml
http://www.flipcode.com/articles/article_directshow02.shtml
http://www.flipcode.com/articles/article_directshow03.shtml

Also, the MSDN is full of information and the Microsoft Video forum is frequented by very knowledgable (if slightly less accomodating ;p )people.

Kind regards,
Mark

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this