- Home /
What is required from a device to be read in a WebcamTexture?
Hello
I created a directshow filter to create a virtual webcam device. It works with most software (VLC, Virtools, GraphEdit). But when I try to use it in Unity with WebcamTexture, it doesn't works.
The device is present in the array provided by WebcamTexture.devices
Creation of the WebcamTexture works. (For information, if I tried to create a WebcamTexture with an invalid device name, I would get this error :
Cannot find webcam device BadName.
)When I try to use
myWebCamTexture.Play()
, I get this error :ERROR - Could not find specified video device
So, Unity sees my device (it appears in WebcamTexture.devices) but seems unable to use it. Why?
The very same scipt works perfectly with real webcams, and with other virtual cams (ex : e2esoft VCam).
I know this is a very specific question, but does anyone knows how does Unity handle webcam? (in particular, what in the difference with how other softwares handle it).
Edit :
My directshow filter implement these interfaces
IAMStreamConfig
IBaseFilter
IKsPropertySet
IMediaFilter
IPersist
ISpecifyPropertyPages
While another directshow filter (e2esoft vcam) that works within Unity implement these ones :
IAMFilterMiscFlags
IAMVideoControl
IAMVideoProcAmp
IBaseFilter
IKSPropertySet
IMediaFilter
IMediaSeeking
IPersist
IPersistStream
ISpecifyPropertyPages
In bold are the interfaces that are missing in my filter. Are these all required to be used as webcam by Unity? Or do I only need to implement a specific one?
Seems you asked this before: http://answers.unity3d.com/questions/232205/why-cant-i-use-a-virtual-device-with-webcamtexture.html Good question. To bump it, just edit it a little or add a comment.
Hi buddy, I am running into the same problem. Did u figure it out?
Hi, has anyone found the answer to this question? I've tried quite a few method to use a DirectShow filter in Unity with no luck.
Answer by MetaAdam · Dec 17, 2016 at 11:09 PM
Sorry for bumping an old thread but in case anyone else runs into this issue here's a solution that worked for me.
Unity appears to use a library called VideoInput.
This checks for a Device Path. You can add one to your filter's registry entry during DllRegisterServer using the code snippet from this blog.
This adds a subkey called DevicePath with value of "foo:bar" (a dummy device path is fine).
Once I did this my filter was correctly showing in Unity.
Your answer
Follow this Question
Related Questions
Webcamtexture at 1080p 50fps produces black image 1 Answer
web cam texture to video file(editor and web both) 2 Answers
How can I save a webcam recording to a video file in Unity? 2 Answers
How do I set pixels with WebCamTexture.GetPixels 1 Answer
WebGL Webcam light keeps enabled after stoping WebCamTexture 0 Answers