Page 3 of 7

Posted: Sat Mar 10, 2007 3:59 am
by KungFooMasta
Sorry, I missed that line in the log.

Wow, the resolution is big!

Code: Select all

18:48:56: [DSHOW] Creating texture with dimensions 2048x1024.
18:48:56: WARNING: Texture instance 'DirectShowManualTexture' was defined as manually loaded, but no manual loader was provided. This Resource will be lost if it has to be reloaded.
18:48:56: Creating viewport on target 'Lumeria', rendering from camera 'System_Movie_Camera', relative dimensions L: 0.00 T: 0.00 W: 1.00 H: 1.00 ZOrder: 0
18:48:56: Viewport for camera 'System_Movie_Camera', actual dimensions L: 0 T: 0 W: 1280 H: 1016
18:48:56: [DSHOW] Loading movie named 'C:/Ugly.Betty.S01E14.HDTV.XviD-XOR.avi'.
18:48:57: [DSHOW] -> This movie has dimensions: 608x336.
So what should my code look like if I want to gaurd against resolution with X wdith and Y height?

Also, I copied/pasted right out of the wiki yesterday, and the versions do match up.

KungFooMasta

Posted: Sat Mar 10, 2007 4:06 am
by Rackle
>> Edit: why did the page got so wide with this post??

Because of the big image above.

A phpBB MOD/fix is discussed on the phpBB boards and the fix to download. There's also EasyMOD, a MOD Installation modification. Hopefully some of these features will be included in v3 of phpBB.

Posted: Sat Mar 10, 2007 4:36 am
by hmoraldo
Oh, now I see the problem. Look at this line in your code:

Code: Select all

mDShowMovieTexture = new OgreUtils::DirectShowMovieTexture(mWindow->getWidth(), mWindow->getHeight());
You are asking the program to create a texture that has the same dimensions of the window; when you should rather create a texture that has the same dimensions of the video (that, in your case is 608 x 336).

If you don't know the size of the video when starting, you'll need to create the dshow object telling a texture size that is bigger than any video you are going to play (for example, in your case maybe 800x600). Then you'll need to use some basic maths to make the overlay UVs map to the region of the texture that is in use in each video you choose to play (so you'll have to update the UVs in any video change; at least if the new video has a size that is different than the video that was being played before).

And thanks Rackle for your post, I thought the table width got so wider only after I posted my reply, so I was only looking for something bad in my post.

Posted: Sat Mar 10, 2007 8:34 am
by KungFooMasta

Code: Select all

mDShowMovieTexture = new OgreUtils::DirectShowMovieTexture(mWindow->getWidth(), mWindow->getHeight());

Code: Select all

// Create Panel, Overlay, and Show the Overlay
	Ogre::OverlayManager* OM = Ogre::OverlayManager::getSingletonPtr(); 

	if( mOPanel == NULL )
	{
		// Create a panel 
		mOPanel = static_cast<Ogre::OverlayContainer*>( 
			OM->createOverlayElement("Panel", "MoviePanel")); 
	}

	mOPanel->setPosition(0.0,0.0);
	mOPanel->setDimensions(1.0,1.0);
	mOPanel->setColour(Ogre::ColourValue(1.0,1.0,1.0,1.0)); 

	mDShowMovieTexture->loadMovie(mMoviePath);
	Ogre::Vector2 v2 = mDShowMovieTexture->getMovieDimensions();
	dynamic_cast<Ogre::PanelOverlayElement*>(mOPanel)->setUV(0,0,
		v2.x / mWindow->getWidth(),
		v2.y / mWindow->getHeight());

	mOPanel->setMaterialName(mOverlayMaterial.get()->getName());

	mDShowMovieTexture->playMovie();

	// Create an overlay, and add the panel 
	if( mOverlay == NULL )
		mOverlay = OM->create("MovieOverlay"); 

	mOverlay->add2D(mOPanel); 
	mOverlay->show();
This code does the trick for me. Haven't tried different window resolutions, but I have tried another movie, and it took up the screen. Really close to what genva wrote to me earlier.

Thanks for the help all. :D

KungFooMasta

Posted: Sun Mar 11, 2007 12:43 pm
by KungFooMasta
Has anybody been able to successfully stop/pause a movie and then play it again? I wish to pause the movie and ask the user if they want to skip it. If they say no, the movie should resume playing of the movie. However, after calling pause or stop I cannot resume playing or even play the video again. Anybody experiencing anything similar?

My log, not sure what else I can post..

Code: Select all

04:31:21: [DSHOW] Creating texture with dimensions 1280x1016.
04:31:21: WARNING: Texture instance 'DirectShowManualTexture' was defined as manually loaded, but no manual loader was provided. This Resource will be lost if it has to be reloaded.
04:31:21: Texture: _cegui_ogre_0: Loading 1 faces(PF_A8R8G8B8,256x256x1) with 0 generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x256x1.
04:31:21: Creating viewport on target 'Lumeria', rendering from camera 'System_Movie_Camera', relative dimensions L: 0.00 T: 0.00 W: 1.00 H: 1.00 ZOrder: 0
04:31:21: Viewport for camera 'System_Movie_Camera', actual dimensions L: 0 T: 0 W: 1280 H: 1016
04:31:21: [DSHOW] Loading movie named './media/Movies/01 - 14 Years Ago.avi'.
04:31:21: [DSHOW] -> This movie has dimensions: 608x448.
KungFooMasta

Posted: Sun Mar 11, 2007 10:20 pm
by hmoraldo
You should be able to do stop, pause, and play as many times as you wish with no problems, as far as you only pause the video, and don't unload it or anything like that. Do you get the same results when playing other kinds of videos? (videos that use some other code, some mpeg, etc)

Posted: Sun Mar 11, 2007 10:32 pm
by odyeiop
easiest way for pausing and resuming would be to do something like this

global, or add it to the DirectShow class
bool movieState=false;
if you add it to the DirectShow you'd need respective get and set functions

in the keyReleased or keyPressed
movieState = !movieState;
or, if you have the get/set functions
setMovieState(!getMovieState);
then the frameListener would take care of the movie
if(!movieState) movie->pauseMovie();
else if(!movie->isPlayingMovie()) movie->playMovie();

Posted: Mon Mar 12, 2007 7:48 am
by KungFooMasta
Sorry, the pause/play functionality works fine.. :oops:

My code logic was mixed up. I was able to fix it, everything works fine again.

Thanks!

KungFooMasta

Posted: Tue Mar 13, 2007 5:06 am
by hmoraldo
I'm glad it works! thank you for using the code

Posted: Wed Mar 21, 2007 12:40 am
by lathieeshe
Hello,

I've created a small 30 second clip to test out this direct show with ogre. The movie resolution is 1024x768. The window size is also 1024x768. However everytime i play i just get a white screen. I've tired mulitple movies to see if it was the code. Tired avi, mpg, mpeg and wmv. all with the same result. I've even tired different resolution movies, 320x240 and 640x480. It still remains that white till the length of the movie. So i assume it's playing something but i can't see anything other then white. I

Code: Select all

mOverlayMaterial =  Ogre::MaterialManager::getSingletonPtr()->create("MovieMaterial",Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
   mOverlayMaterial->getTechnique(0)->getPass(0)->createTextureUnitState();
   mOverlayMaterial->load(); 

	dshowMovieTextureSystem =new
      OgreUtils::DirectShowMovieTexture(1024, 768);


	Ogre::String movieName="E:/Documents and Settings/Lathieeshe/Desktop/Office_Detective_Camera2321.avi";

	ResourceGroupManager::getSingleton().initialiseResourceGroup("Intro");

	OverlayManager& overlayMgr = OverlayManager::getSingleton();

	//// Create a panel
	  Ogre::OverlayManager* OM = Ogre::OverlayManager::getSingletonPtr(); 
	Ogre::OverlayContainer* panel = static_cast<OverlayContainer*>(overlayMgr.createOverlayElement("Panel", "PanelName"));
	// Create Panel, Overlay, and Show the Overlay
 
	panel->setMetricsMode(Ogre::GMM_RELATIVE);
	panel->setPosition(0, 0);
	panel->setDimensions(1, 1);
	//panel->setColour(Ogre::ColourValue(1.0,1.0,1.0,1.0)); 

	dshowMovieTextureSystem->loadMovie(movieName);

	panel->setMaterialName(mOverlayMaterial->getName());


	 
	 dshowMovieTextureSystem->playMovie();
  
	 Ogre::Overlay* mOverlay =  OM->create("OverlayName");


	mOverlay->add2D(panel);
	mOverlay->show(); 
framestarted has

Code: Select all

dshowMovieTextureSystem->updateMovieTexture();

Code: Select all

19:34:48: ***************************************
19:34:48: *** D3D9 : Subsystem Initialised OK ***
19:34:48: ***************************************
19:34:48: ResourceBackgroundQueue - threading disabled
19:34:48: Particle Renderer Type 'billboard' registered
19:34:48: Win32Input8: DirectInput Activation Starts
19:34:48: Win32Input8: Establishing keyboard input.
19:34:48: Win32Input8: Keyboard input established.
19:34:48: Win32Input8: Establishing mouse input.
19:34:48: Win32Input8: Mouse input established.
19:34:48: Win32Input8: DirectInput OK.
19:34:48: Creating viewport on target 'MyOgreWindow', rendering from camera 'IntroCam', relative dimensions L: 0.00 T: 0.00 W: 1.00 H: 1.00 ZOrder: 0
19:34:48: Viewport for camera 'IntroCam', actual dimensions L: 0 T: 0 W: 1024 H: 768
19:34:48: [DSHOW] Creating texture with dimensions 1024x768.
19:34:48: Initialising resource group Intro
19:34:48: Parsing scripts for resource group Intro
19:34:48: Finished parsing scripts for resource group Intro
19:34:48: [DSHOW] Loading movie named 'E:/Documents and Settings/Lathieeshe/Desktop/Office_Detective_Camera2321.avi'.
Also found that in the ogre.log. Didnt seen any exception being thrown either. Any ideas?

Posted: Wed Mar 21, 2007 1:35 am
by hmoraldo
Don't you call play() to start the video? Use video sound as a hint for knowing whether it's already playing or not.

Posted: Wed Mar 21, 2007 2:42 am
by lathieeshe

Code: Select all

  dshowMovieTextureSystem->playMovie(); 
i thought by calling that. you start the movie to play.

Code: Select all

dshowMovieTextureSystem->isPlayingMovie();
then i use this to check if the movie is playing or not.

is that correct?

Posted: Wed Mar 21, 2007 6:04 am
by lathieeshe

Code: Select all

	Ogre::MaterialPtr materialPtr;
   Ogre::TextureUnitState* texUnit;

   Ogre::String materialName = "MovieMaterial";
   Ogre::MaterialManager::getSingleton().resourceExists(materialName);
   materialPtr = Ogre::MaterialManager::getSingleton().getByName(materialName);
   texUnit = materialPtr->getTechnique(0)->getPass(0)->getTextureUnitState(0);
   texUnit->setTextureName(dshowMovieTextureSystem->getMovieTexture()->getName());
friend looked at it. and realized i was missing this. now the movie is playing. but there is lag. any idea guys as to why? does the resolution size matter? currently it is 1024x768. The file size is about 5mbs.

Posted: Wed Mar 21, 2007 2:17 pm
by hmoraldo
Oh, you are right, you were already playing it.

The dshow class isn't very optimized; it copies each frame pixel per pixel to the target texture, using a pair of C for-loops, no asm, no other code optimization (and anyway, as writing to texture is always slow because of the video card, there wouldn't such an important gain if optimizing it in the cpu). So yes, 1024x768 can be part of the problem, if the computer isn't fast enough; try with 800x600 or some similar res to see if you keep having that problem.

Posted: Wed Mar 21, 2007 2:40 pm
by lathieeshe
ya i just checked a really same resolution size. 320x240. Tired it on two different computers still lag. I'm wondering if there something wrong with the codec or any optimization that i could do. i read something about doubling the texture size and that this feature by default disabled? would that work? if so how to enable it?

any help would be appreciated. thanks again.

Posted: Wed Mar 21, 2007 2:47 pm
by hmoraldo
That wouldn't help, you shouldn't be having lag with videos that small. Can you describe your computer? (video card & micro)

Posted: Wed Mar 21, 2007 2:49 pm
by lathieeshe
The PC Specs are,

CPU:
AMD Athlom 64 3000+ 1.8Ghz
1024RAM
Videocard:
NVIDIA Gefore 6600 GT

that's what im running.

Posted: Wed Mar 21, 2007 3:01 pm
by hmoraldo
What do you call lag? is it the time between loading and playing, or is it a decrease in fps?

You shouldn't be experiencing the second in your computer; the first is possible as direct show is doing streaming and it's no rare that it takes around half a second to start streaming.

Do you have the same problem when playing the video with the media player? can you try with another video (some movie, etc)?

Posted: Wed Mar 21, 2007 3:12 pm
by lathieeshe
yes i've tired multiple videos. Using windows media player it plays fine. It's choppy. As in i can see it ghosting and skipping frames. I'm using standard 29.7 frames per second for the video. It's just directly exported out of adobe premiere. I've even brought the quality down even further by using window movie maker so the its a 512kps. Still the same problem.

Posted: Wed Mar 21, 2007 3:22 pm
by lathieeshe
i thought maybe im doing something really wrong with the video. But when i turned on my speakers, the audio is choppy as well. Lots of weird stuttering. I put a frame counter on it. It's running between 30fps to 35fps. But it does drop sometimes to 24fps.

Posted: Wed Mar 21, 2007 3:43 pm
by hmoraldo
Download some movie trailer from internet and test with that. Maybe there is something wrong with your codec on direct show.

Posted: Wed Mar 21, 2007 4:27 pm
by lathieeshe
do you happen to know if a specific setting i should be using for DirectShow to render correctly. I downloaded window media encoder and am trying the settings.

Posted: Wed Mar 21, 2007 9:10 pm
by odyeiop
hey Tito.. I used the exact code from the Wiki and it works fine here.

If Eric has a copy of what you're doing I can have him compare what you guys have and what we have.

Posted: Wed Mar 21, 2007 9:35 pm
by Loockas
Hey,
I've got the runtime error while trying to run my app. I've used the simplest code from wiki and it compiles fine though there was a problem with missing ddraw.h file but after installing directx sdk all went well. Anyone has encountered that issue with runtime error?

Posted: Thu Mar 22, 2007 1:08 am
by lathieeshe
hey odyeiop,

really? did u you see my source code up on top. i made an overlay. you got all resolutions working with sound and no stuttering? Because right now im running at 320x240 and i really hate it. lol. please help.