Please post details on the error (error message, stack trace), and the log file, otherwise we can't tell much about the problem.Loockas wrote: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?
(Code Snippet) Video reproduction using DirectShow
- hmoraldo
- OGRE Expert User
- Posts: 517
- Joined: Tue Mar 07, 2006 11:22 pm
- Location: Buenos Aires, Argentina
- x 1
- Contact:
H. Hernan Moraldo
Personal website
Personal website
-
- Goblin
- Posts: 225
- Joined: Sun Sep 25, 2005 3:22 am
- Location: Calgary, Alberta
- x 1
Hopefully it isn't considered poor taste to offer a small bounty for what should be a very small amount of work? If it is, I apologize and promise not to do it again. If you aren't offended however, feel free to read http://www.ogre3d.org/phpBB2addons/view ... hp?p=22182
The task will take me 2-3 hours tomorrow so the price seems reasonable given that the result benefits the (python) Ogre community. If you're interested, please read the thread carefully - I'll pay only if it passes muster by the python-ogre guys. If I (or they) have to start mucking around with your submission, it defeats the purpose of offering a bounty. If you're going to do it, post a message in the thread - no use a slew of people recreating the proverbial wheel.
The task will take me 2-3 hours tomorrow so the price seems reasonable given that the result benefits the (python) Ogre community. If you're interested, please read the thread carefully - I'll pay only if it passes muster by the python-ogre guys. If I (or they) have to start mucking around with your submission, it defeats the purpose of offering a bounty. If you're going to do it, post a message in the thread - no use a slew of people recreating the proverbial wheel.
- hmoraldo
- OGRE Expert User
- Posts: 517
- Joined: Tue Mar 07, 2006 11:22 pm
- Location: Buenos Aires, Argentina
- x 1
- Contact:
- Loockas
- Kobold
- Posts: 28
- Joined: Wed Aug 02, 2006 11:45 am
- Location: Poland
I've noticed that my app crashes just after the loadmovie function.hmoraldo wrote:Please post details on the error (error message, stack trace), and the log file, otherwise we can't tell much about the problem.Loockas wrote: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?
I've got this error:
And my log file ends with this:
Code: Select all
15:32:44: [DSHOW] Creating texture with dimensions 640x480.
15:32:44: [DSHOW] Loading movie named 'C:/test_movie.avi'.
Umm just one question. How can I load my video not from specified path but from my media folder just like a resource?
Oh, and one more thing. How to set fullscreen? I can't use the setUV function because there is no PanelOverlayElement class...
- independentCreations
- Greenskin
- Posts: 121
- Joined: Sat Jan 07, 2006 7:30 am
- Location: Gold Coast - Australia
@Loockas i have the same crashing problem as yours, i have used directshow before and come across this but i forget how i resolved the issue. My audio works, but i get a crash and i dont see any visual. is there any codec that i should be using????
:Edit: fixed first, material error
Also has any one come across and got around the debugger detected message with visual studio??
:Edit: To find a movie and its relative path using ogre
:Edit: fixed first, material error
Also has any one come across and got around the debugger detected message with visual studio??
:Edit: To find a movie and its relative path using ogre
Code: Select all
Ogre::String path;
Ogre::FileInfoListPtr results = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("General", "*.avi");
Ogre::FileInfoList::iterator itr = results->begin();
while(itr != results->end())
{
if((*itr).filename == "Cova_Marketing.avi")
{
path = (*itr).archive->getName() + "/" + (*itr).filename;
m_clip->loadMovie(path);
m_clip->playMovie();
//and so on
break;
}
itr ++;
}
Final Creations - Tech Leader For 'The Broken'
v2i - Tech Leader For Architectual Sim.
Ogre Enthusiast
v2i - Tech Leader For Architectual Sim.
Ogre Enthusiast
-
- Gnoblar
- Posts: 6
- Joined: Sun Apr 01, 2007 5:19 pm
- syedhs
- Silver Sponsor
- Posts: 2703
- Joined: Mon Aug 29, 2005 3:24 pm
- Location: Kuala Lumpur, Malaysia
- x 51
Sorry to revive this thread - but I faced the same problem as Ahmedali's. Not sure you are still having this problem, but I get this solved by manually setting the subtype & formattype. Originally it was this:-ahmedali wrote:I solved the xvid problem by turning the compatibility option on in its decoder properties. But the mpeg2 problem remains.
Code: Select all
mt.subtype = MEDIASUBTYPE_RGB24;
mt.formattype = FORMAT_VideoInfo;
Code: Select all
mt.subtype = MEDIASUBTYPE_MPEG2_VIDEO;
mt.formattype = FORMAT_MPEG2Video;
Thanks hmoraldo!
Edit: Opss premature solution.. there video doesn't get displayed
- syedhs
- Silver Sponsor
- Posts: 2703
- Joined: Mon Aug 29, 2005 3:24 pm
- Location: Kuala Lumpur, Malaysia
- x 51
Yay.. 80% done! MPEG2 get displayed although DIVX still dont get displayed. I think it should get displayed because the modification to make it work is based on this: http://www.codeproject.com/audio/VideoA ... ct=1797483
and the binary downloaded from there is able to display all files. The remaining 20% job is
1) to get the frames synched with audio (now the frames are displayed as fast as possible).
2) COMs object cleanup.
3) getting the video synched with audio,
To those interested, below is my modification:-
loadMovie
and the supporting functions...
and the binary downloaded from there is able to display all files. The remaining 20% job is
1) to get the frames synched with audio (now the frames are displayed as fast as possible).
2) COMs object cleanup.
3) getting the video synched with audio,
To those interested, below is my modification:-
loadMovie
Code: Select all
hr=dsdata->pGrabber->SetMediaType(&mt);
if (FAILED(hr)) throw("[DSHOW] Error in setting sample grabber media type");
//---------------Starts here
IBaseFilter* srcFilter;
WCHAR* filepath = util_convertCStringToWString(moviePath.c_str());
hr = dsdata->pGraph->AddSourceFilter(filepath, L"Source", &srcFilter);
if(FAILED(hr)) throw ("[DSHOW] Unsupported media type!");
// Connect the src and grabber
hr = ConnectFilters(dsdata->pGraph, srcFilter, dsdata->pGrabberF);
if(FAILED(hr)) throw ("[DSHOW] Unsupported media type!");
//---------------End here
// open the file!
hr=dsdata->pGraph->RenderFile(filepath, NULL);
if (FAILED(hr)) throw("[DSHOW] Error opening video file!");
Code: Select all
HRESULT DirectShowMovieTexture::ConnectFilters(IGraphBuilder *pGraph, IBaseFilter *pFirst, IBaseFilter *pSecond)
{
IPin *pOut = NULL, *pIn = NULL;
HRESULT hr = GetPin(pSecond, PINDIR_INPUT, &pIn);
if (FAILED(hr)) return hr;
// The previous filter may have multiple outputs, so try each one!
IEnumPins *pEnum;
pFirst->EnumPins(&pEnum);
while(pEnum->Next(1, &pOut, 0) == S_OK)
{
PIN_DIRECTION PinDirThis;
pOut->QueryDirection(&PinDirThis);
if (PINDIR_OUTPUT == PinDirThis)
{
hr = pGraph->Connect(pOut, pIn);
if(!FAILED(hr))
{
break;
}
}
}
pEnum->Release();
pIn->Release();
pOut->Release();
return hr;
}
// Helper functions:
HRESULT DirectShowMovieTexture::GetPin(IBaseFilter *pFilter, _PinDirection PinDir, IPin **ppPin)
{
IEnumPins *pEnum;
IPin *pPin;
pFilter->EnumPins(&pEnum);
while(pEnum->Next(1, &pPin, 0) == S_OK)
{
PIN_DIRECTION PinDirThis;
pPin->QueryDirection(&PinDirThis);
if (PinDir == PinDirThis)
{
pEnum->Release();
*ppPin = pPin;
return S_OK;
}
pPin->Release();
}
pEnum->Release();
return E_FAIL;
}
- manowar
- Orc
- Posts: 419
- Joined: Thu Apr 07, 2005 2:11 pm
- Location: UK
- Contact:
- manowar
- Orc
- Posts: 419
- Joined: Thu Apr 07, 2005 2:11 pm
- Location: UK
- Contact:
I had a look on the code, and the Ogre::Texture is created before the movie is loaded. Why not loading the movie and then create the Ogre::Texture using the actual movie dimensions (dsdata->videoWidth, dsdata->videoHeight) ? I quickly hacked the code and moved the texture creation after the movie is loaded and it seems to work fine.
Is there anything wrong with doing that ? I do not have to modify the uvs which is not always simple when videos are applied on parts of models exported from modeling tools.
Is there anything wrong with doing that ? I do not have to modify the uvs which is not always simple when videos are applied on parts of models exported from modeling tools.
- hmoraldo
- OGRE Expert User
- Posts: 517
- Joined: Tue Mar 07, 2006 11:22 pm
- Location: Buenos Aires, Argentina
- x 1
- Contact:
Hi. First of all, this code snippet is meant to be a simple class that deals with videos, so I'm not giving it full features but rather keeping simple enough so that any interested user can just modify the code to make it fits his/her needs. (Different and more complex versions of the code, to be published in neighbour pages on the wiki are welcome too)
The reason why I'm not using the video size to create the texture is that I'm rather trying to use a single texture to fit all videos that are going to be played in an application. And as only the user (and not the app) can know what the maximum size of a video to be played by the application is going to be, I'm keeping the selection of the texture size in hands of the programmer.
It's a personal choice, and of course there are plenty of alternatives. I could have coded it to create a new texture only when the newest video is bigger than the previous ones, or I could have coded it so that each video opened uses a different texture. In this case I chose the option explained above, as it was best fit for the use I was giving this resource and also as it was also appealingly simple. But by no means I say this is the best of all options, or that it should be best for all users or uses.
Thanks for your comments :)
The reason why I'm not using the video size to create the texture is that I'm rather trying to use a single texture to fit all videos that are going to be played in an application. And as only the user (and not the app) can know what the maximum size of a video to be played by the application is going to be, I'm keeping the selection of the texture size in hands of the programmer.
It's a personal choice, and of course there are plenty of alternatives. I could have coded it to create a new texture only when the newest video is bigger than the previous ones, or I could have coded it so that each video opened uses a different texture. In this case I chose the option explained above, as it was best fit for the use I was giving this resource and also as it was also appealingly simple. But by no means I say this is the best of all options, or that it should be best for all users or uses.
Thanks for your comments :)
H. Hernan Moraldo
Personal website
Personal website
-
- Kobold
- Posts: 29
- Joined: Fri Jun 08, 2007 7:20 am
- x 1
so I'm having the same issue KungFooMasta did, the video playing in the upper left hand corner. I used his setUV call, and it made the movie smaller, and it gets reproduced multiple times over the panel. Any ideas?
The video size is 640x480, screen resolution is 1152x864.
edit: Fixed, always the stupid errors.
The video size is 640x480, screen resolution is 1152x864.
edit: Fixed, always the stupid errors.
- jona vark
- Gold Sponsor
- Posts: 83
- Joined: Tue May 01, 2007 2:38 am
I have been able to compile this under VS2005 but I am having a problem with Coinitialize()
hr is returnd as RPC_E_CHANGED_MODE
Which I guess means that some form of Coinititalize() was already called?
So should I check for this value and bypass Coinitialize() in that case?
thanks Jona
Edit:
I see you've all been dealing with the same sort of issues in this thread. When I posted this I had not seen the entire thread. I will review it. Meanwhile any insight is indeed helpful.
Code: Select all
hr=CoInitialize(NULL);
if (FAILED(hr))
{
throw("[DSHOW] Error in co initialize");
}
Which I guess means that some form of Coinititalize() was already called?
So should I check for this value and bypass Coinitialize() in that case?
thanks Jona
Edit:
I see you've all been dealing with the same sort of issues in this thread. When I posted this I had not seen the entire thread. I will review it. Meanwhile any insight is indeed helpful.
-
- Gremlin
- Posts: 158
- Joined: Tue Jan 17, 2006 12:09 am
- jona vark
- Gold Sponsor
- Posts: 83
- Joined: Tue May 01, 2007 2:38 am
As far as I can tell after only a couple of hours into it. You have to setup the MEDIASUBTYPE and other parms for the SampleGrabber code. So your video file and those parms have to match. See earlier parts of this thread.
Seems to be an issue with DV though that I am working out. I am trying to determine how you find the MEDIASUBTYPE of a file.
edit:
I was not able to get this puppy to work for me. Seems like any file type I tried failed. I was able to play the AUDIO of a DV_25 file with the MEDIASUBTYPE_DV25 and MEDIASUBTYPE_Avi but never got imagery with a wmv file or a MS Video1 avi file.
Purging on.
Seems to be an issue with DV though that I am working out. I am trying to determine how you find the MEDIASUBTYPE of a file.
edit:
I was not able to get this puppy to work for me. Seems like any file type I tried failed. I was able to play the AUDIO of a DV_25 file with the MEDIASUBTYPE_DV25 and MEDIASUBTYPE_Avi but never got imagery with a wmv file or a MS Video1 avi file.
Purging on.
- hmoraldo
- OGRE Expert User
- Posts: 517
- Joined: Tue Mar 07, 2006 11:22 pm
- Location: Buenos Aires, Argentina
- x 1
- Contact:
The code is under the zLib license. Apart from a few details, you can do with this what you could do anyway without this: so I guess what you can or you cannot do with such code rather depends on the license of that codec. But, as far as I know, as you are not using the codec directly, but through DirectShow, your program doesn't depend that much on the codec's license as in DirectShow's.ricardo_arango wrote:Are there any license issues when using this?
Let's say for example to play an avi with a cinepak radius codec4?
But I'm not an attorney so I can't really say for sure. Does anyone know better?
Jona Vark: sorry, I don't know why you are having these problems (I guess they require some additional directshow programming to get them working, but I have no time to check that). I can recommend you to try with other video formats? Mpeg has always worked fine for me, and anyway you could try converting some video to a few popular video formats to find those that work.
I'm sorry I couldn't give you more useful answers...
Best regards,
H. Hernan Moraldo
Personal website
Personal website
- hmoraldo
- OGRE Expert User
- Posts: 517
- Joined: Tue Mar 07, 2006 11:22 pm
- Location: Buenos Aires, Argentina
- x 1
- Contact:
Thank you!
By the way, it's strange you aren't getting any visuals. Maybe the texture is being updated but you aren't seeing it? That you are getting the sound is generally the sign that you are very nearly making it work.
Regards!
By the way, it's strange you aren't getting any visuals. Maybe the texture is being updated but you aren't seeing it? That you are getting the sound is generally the sign that you are very nearly making it work.
Regards!
H. Hernan Moraldo
Personal website
Personal website
- jona vark
- Gold Sponsor
- Posts: 83
- Joined: Tue May 01, 2007 2:38 am
Yes. I am working on it this morning and the first thing I am trying to get past is the fact that CoInitialize() failes. Even if I try to do it prior to any Ogre Init. I keep getting the RPC_E_CHANGED_MODE response.
I was able to play audio though, depending on the file type. I have created avi, dv, mpeg2 and wmv files to try and I have changed the MEDIASUBTYPE from _DV25 to _Avi and back to the RGB24 it was originally.
I am starting to wade through DirectShow doc but there isn't much there on what to do with the RPC_E_CHANGED_MODE result. From what I can tell it indicates that :
This did not fail though:
.
hr is always returned as S_FALSE. Oddly all of the other calls to CoCreateInstance and AddFilter, etc return hr=0; So they seem fine. Like somthing else has called CoInitialize.
However. With most file types I get :
On we go. My target is to have live video on Ogre Textures at some point
EDIT
Whew.. ok.. CoInitialize is the thread starter for COM? This is apparently another Rabbit Hole that would suck up my entire weekend. Even when CoInitialize is the first thing my app does it returns other than S_OK.
But this is a DShow problem. Not an Ogre problem.
I was able to play audio though, depending on the file type. I have created avi, dv, mpeg2 and wmv files to try and I have changed the MEDIASUBTYPE from _DV25 to _Avi and back to the RGB24 it was originally.
I am starting to wade through DirectShow doc but there isn't much there on what to do with the RPC_E_CHANGED_MODE result. From what I can tell it indicates that :
Doh! I have little idea where that previous call could have come from.A previous call to CoInitializeEx specified a different concurrency model for the calling thread, or the thread that called CoInitializeEx currently belongs to the neutral threaded apartment.
This did not fail though:
.
Code: Select all
HRESULT hr;
hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
if(FAILED(hr))
{
throw("[DSHOW] Error in co initialize");
}
However. With most file types I get :
When callingFirst-chance exception at 0x0862a8ed in daac.exe: 0xC0000005: Access violation writing location 0x00000000.
Code: Select all
hr=dsdata->pGraph->RenderFile(filepath, NULL);
EDIT
Whew.. ok.. CoInitialize is the thread starter for COM? This is apparently another Rabbit Hole that would suck up my entire weekend. Even when CoInitialize is the first thing my app does it returns other than S_OK.
But this is a DShow problem. Not an Ogre problem.
- jona vark
- Gold Sponsor
- Posts: 83
- Joined: Tue May 01, 2007 2:38 am
If you get back to this thread .. I wanted to ask you. DO YOU Have NERO6 installed on your machine?MickeMicke wrote:Hi! I've got this error when I'm running Visual Studio and using DirectShow, otherwise not:
Any suggestions?
see this:http://www.hitlabnz.org/forum/showthread.php?t=70
UPDATE!
THIS WAS THE PROBLEM WITH MY MACHINE RUNNING THIS DEMO!
Yesterday , just to make sure I wasn't crazy I installed the latest Platform SDK, OgreSDK on another machine and rebuilt my entire project.
At the end of the day I had a wmv file playing in one of my textures on a plane.
So I took that project back to the main workstation and built it. Again I got the warning MessageBox shown above. The next thing I did was to uninstall Nero6 and ran again. Without rebuilding. I didn't bother to find out why but it's clearly a part of a protection scheme.
It worked.
That program is gone forever from my machine. Anyone trying to use the DShow features which use video codecs should not have Nero6 on their machine.
- hmoraldo
- OGRE Expert User
- Posts: 517
- Joined: Tue Mar 07, 2006 11:22 pm
- Location: Buenos Aires, Argentina
- x 1
- Contact:
I'm glad to know you could solve it, thanks for telling us how you did it!
H. Hernan Moraldo
Personal website
Personal website
-
- Gremlin
- Posts: 158
- Joined: Tue Jan 17, 2006 12:09 am
I am trying to watch a video encoded with XVid. I checked the video in media player and it played fine.
When I tried to load it with the code it crashed in
returning hr=0x80040209, which means:
An interface has too many methods to fire events from
If i try setting "compatibility renderer" in the Decoder Options dialog for Xvid, as someone recommended in a previous post, I get the "Protection Error, Debugger Detected error dialog", which is supposed to have something to do with Nero, but there is no way to deny a user from having Nero installed..
So, anyone got XVid working?
When I tried to load it with the code it crashed in
Code: Select all
if (FAILED(hr)) throw("[DSHOW] Error getting connected media type info");
An interface has too many methods to fire events from
If i try setting "compatibility renderer" in the Decoder Options dialog for Xvid, as someone recommended in a previous post, I get the "Protection Error, Debugger Detected error dialog", which is supposed to have something to do with Nero, but there is no way to deny a user from having Nero installed..
So, anyone got XVid working?