Well i was trying to run the DxLogoVB Example, and sadly it didn't want to run.
It is throwing and Invalid Cast Exception Inside SetConfigParams, specificlly on the following line of code:
Dim videoControl As IAMVideoControl = DirectCast(capFilter, IAMVideoControl)
I'm just going trough the code, and i'm still kind of cluless on the class ( going trough examples and MSDN Directshow ) can someone tell me what is wrong here??
Thanks.
Alex.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This happens to me too, but then I realized I don't have a video capture device connected on my PC. I think the exception is being thrown because the call to IAMVideoControl is failing.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I would expect that if you have no capture device, it would throw a "No video capture devices found at that index!" exception well before you get down to the DirectCast statement this person refers to.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I ran into this myself. I have a capture driver installed but no capture device connected. My system will show the driver, so it'll pass the first test. Without a physical device connected to it, the code will fail. The C# version of DXLogo does the same thing for me.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am having the same problem. I did not change anything of the code.
I have the actual capture device on.
If I remove the next line (DsError.Throw...), the code can work. But now I need to change the size of the captured pictures. I do not know what is wrong with this part.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I used the size 640x480, but it did not work. SetFormat(media) failed. And the error is "unspecified".
I have a question about the v.VmiHeader ---- should I change ImageSize property manually if I change the picture size? is it right for this value stay at 230400? It seems the media also has such a size property at value 230400...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The "still" pin is for taking snapshots. I doubt you can capture video from it. It is not uncommon for "still" pins to have higher resolutions than capture pins (which DO support video).
For taking snapshots, see the DxSnap sample.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well as i read on one of your answers on another post you said that the best way to set the size of the video output was following the example of SetConfigParms in the DxLogo, as you probably know by now i'm working on VB.net and the example was failing in this line:
It is throwing and Invalid Cast Exception Inside SetConfigParams, specificlly on the following line of code:
Dim videoControl As IAMVideoControl = DirectCast(capFilter, IAMVideoControl)
giving an invalid cast, i already tried using ctype, but didn't work either, the only workaround i found by now is i created a small Class Project in C# where i copied the SetConfigParms from DxLogo C# and it worked just fine. so for now if someone needs to have that function working on a Vb.net project my best advice will be create a small project in C# and call that specific C# function from vb.net
Alex.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Using DirectCast like this is VB's way of doing QueryInterface. This sounds like the device you are running against doesn't support the IAMVideoControl interface. Are you using the unmodified source? Or have you changed anything?
You could try changing the DirectCast to CType.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Very sorry.
I ve tried to delete my msgs but failed.
I checked again and found the exception is throwed because I changed the size of width and height of the vedio.
Now I am wondering whehter I can use different sizes for the same capture device? or I need to zoom in or out to the proper size after the capture?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The forum doesn't allow for the deletion of messages.
Video devices commonly support different output sizes, but usually only from a specific list of sizes (ie you probably can't set the size to 123 x 456, but 320x240, 640 x 480 etc will work).
To find out what video resolutions your device supports, you can walk the capabilities returned by IAMStreamConfig. There is a (compiled) c++ program to do that at http://www.LimeGreenSocks.com/DShow named dumpvcap.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well i was trying to run the DxLogoVB Example, and sadly it didn't want to run.
It is throwing and Invalid Cast Exception Inside SetConfigParams, specificlly on the following line of code:
I'm just going trough the code, and i'm still kind of cluless on the class ( going trough examples and MSDN Directshow ) can someone tell me what is wrong here??
Thanks.
Alex.
This happens to me too, but then I realized I don't have a video capture device connected on my PC. I think the exception is being thrown because the call to IAMVideoControl is failing.
That's odd.
I would expect that if you have no capture device, it would throw a "No video capture devices found at that index!" exception well before you get down to the DirectCast statement this person refers to.
I ran into this myself. I have a capture driver installed but no capture device connected. My system will show the driver, so it'll pass the first test. Without a physical device connected to it, the code will fail. The C# version of DXLogo does the same thing for me.
I am having the same problem. I did not change anything of the code.
I have the actual capture device on.
If I remove the next line (DsError.Throw...), the code can work. But now I need to change the size of the captured pictures. I do not know what is wrong with this part.
Thanks for your reply.
I used the size 640x480, but it did not work. SetFormat(media) failed. And the error is "unspecified".
I have a question about the v.VmiHeader ---- should I change ImageSize property manually if I change the picture size? is it right for this value stay at 230400? It seems the media also has such a size property at value 230400...
Again, just ignore my last msg.
I ran the dumpvcap and found only one pin "Still" (other 2 pins are "Capture" and "Preview") support 640x480.
Then I changed all "PinCategory.Capture" to "PinCategory.Still", but the avi file cannot be played.
Can you tell me how can I change the pin to "Still" to capture vedio?
Thanks.
The "still" pin is for taking snapshots. I doubt you can capture video from it. It is not uncommon for "still" pins to have higher resolutions than capture pins (which DO support video).
For taking snapshots, see the DxSnap sample.
Well as i read on one of your answers on another post you said that the best way to set the size of the video output was following the example of SetConfigParms in the DxLogo, as you probably know by now i'm working on VB.net and the example was failing in this line:
It is throwing and Invalid Cast Exception Inside SetConfigParams, specificlly on the following line of code:
Dim videoControl As IAMVideoControl = DirectCast(capFilter, IAMVideoControl)
giving an invalid cast, i already tried using ctype, but didn't work either, the only workaround i found by now is i created a small Class Project in C# where i copied the SetConfigParms from DxLogo C# and it worked just fine. so for now if someone needs to have that function working on a Vb.net project my best advice will be create a small project in C# and call that specific C# function from vb.net
Alex.
Well that's odd.
Using DirectCast like this is VB's way of doing QueryInterface. This sounds like the device you are running against doesn't support the IAMVideoControl interface. Are you using the unmodified source? Or have you changed anything?
You could try changing the DirectCast to CType.
Sorry, the error here is different from the above.
I run this program several times, but exception occurs when (different place at different time) --
DsError.ThrowExceptionForHR(hr)
hr became -2147467259.
I ran once successfully when I comment one ThrowException, but now this exception happens somewhere else again!
How can I solve the problem please?
Very sorry.
I ve tried to delete my msgs but failed.
I checked again and found the exception is throwed because I changed the size of width and height of the vedio.
Now I am wondering whehter I can use different sizes for the same capture device? or I need to zoom in or out to the proper size after the capture?
The forum doesn't allow for the deletion of messages.
Video devices commonly support different output sizes, but usually only from a specific list of sizes (ie you probably can't set the size to 123 x 456, but 320x240, 640 x 480 etc will work).
To find out what video resolutions your device supports, you can walk the capabilities returned by IAMStreamConfig. There is a (compiled) c++ program to do that at http://www.LimeGreenSocks.com/DShow named dumpvcap.
I know this is an old thread but somebody might need the solution.
This works for me:
Dim videoControl As IAMVideoControl = TryCast(capFilter, IAMVideoControl)
Peter