I need to create a virtual webcam that poses as a webcam, but takes as input a set of images that it plays. I have seen solutions like ManyCam, and Fake Webcam, but they all seem to one limitation or the other (resolution, max file size, fps etc.) I am working on Windows XP SP3.
I understand that I have to write a WIA interface for this task, but being a Python programmer, I have never written drivers or interfaces to devices. What are the main tasks in writing this interface ? What would the flow look like ?
You need to write DirectShow filter which is a COM server that implements an IPin, IAMStreamConfig and IKsPropertySet interfaces. For the IPin part you'd better to start by inheriting the CSourceStream class, for that you need to get the Windows SDK, having the SDK installed there would be a DirectShow Base Classes sources in samples\multimedia\directshow folder, there you'll find the CSourceStream (among many others). DllRegisterServer function of the COM server should register your filter within CLSID_VideoInputDeviceCategory category using filter mapper.
After building the COM-server, you register it with regsvr32 tool, and your virtual webcam should appear in the web cam lists.
Also check the samples\multimedia\directshow\filters\ball sample that can be improved and used as a starting point for your task.
Read this first
https://learn.microsoft.com/en-us/windows/win32/directshow/writing-source-filters
Then you can adopt
https://github.com/roman380/tmhare.mvps.org-vcam
You can work on top of this sample virtual camera.
This implements IAMStreamConfig and IKsPropertySet interfaces
This is built using CSourceStream and CSource class which implements IPin and IBaseFilter
Related
I would like to write a gstreamer pipeline that mixes the audio from two sources. I then want to be able to select an audio source from an app on my computer, i.e. Discord, such that the mixed audio will play as if it was coming from my mic.
It seems simple enough to get the mixing right, but it seems like I need to use something like Virtual Audio Cable to achieve the second part. Is there a way to do this entirely in gstreamer or with something more lightweight than installing Virtual Audio Cable?
There is no [yet] Windows API to create virtual audio endpoint, so that applications could interact with it similarly to real device. Consequently, there is no GStreamer wrapper over this non-existent API either.
Doing it without VAC would require that you still install an audio driver where you would provide your own endpoint for Windows to use and expose to applications.
I want to make a virtual web cam application. so I find out all pages that had written before 2010.
But there was no result. All the projects are old even I open and some parts of methods of codeproject's sources is doesn't useful now.
So I'm looking for a replacement of DirectShow. I tried following directshow guide even the getting started guide in docs.ms didn't work.
What should I do?...
So this is an AB question: you need one thing and instead you ask for another.
Yes, there is replacement for DirectShow. DirectShow is a previous multimedia API in Windows, and its successor API and current API in Windows is Media Foundation. This will however get you not an inch closer to the solution of your original problem.
The concept of virtual camera is abstract: Windows operating system does not offer a solid extensibility point to add virtual video input devices such that they are visible to application equally to real cameras. To achieve this you are basically supposed to develop and fully featured driver which is not what you want to do.
I covered details in multiple questions here on StackOverflow, I will just mention a few to start reading from:
64 bit Vivek's Virtual Camera
Registering a network video stream as a virtual camera
Virtual webcam input as byte stream
If you want some application designed to work with cameras to "see" your virtual camera as if it was a real camera, you are interested in finding out what API the application is using and if you could submit your virtual implementation as another camera option.
If the application is DirectShow based, you are rather lucky and you can take the path of virtual DirectShow camera (see links above). If the application uses Media Foundation, you are pretty much in a dead end and hooking or API detouring is probably your best option.
Or you have an option to develop a camera driver, which is most likely is not realistic due to required effort (even though such implementations do exist).
Long story short if your target application is consuming cameras via DirectShow API, you are lucky enough and you don't need DirectShow replacement. Virtual camera code and knowledge accumulated over last 20 years is still in good standing.
I am working on project where I need to read a USB camera's input, put some effects on it and then send that data to a virtual camera so it can be accessed by skype etc.
I have compiled and used the vcam filter. I was also able to make a few changes in FillBuffer method. I now need to know that is it possible to send data to vcam filter from another application or do I need to write another filter.
The vcam project you currently have as a template is the interface to other video consuming applications like Skype, those which use DirectShow API to access video capture devices and match in platform/bitness with your filter.
You are responsible for developing the rest of the supposed filter: you either access real device right in your filter (simplifying the task greatly, this is what you fill your FillBuffer with, the code that generates video from another source), or alternatively you are to implement interprocess communication so that FillBuffer implementation could transfer data from another application.
Nethier vcam nor any of standard DriectShow samples offer functionality to cover interprocess communication, and you might also need to deal with other complications: one application and multiple instances of filters to consume video, platform mismatch etc.
See also:
How to implement a "source filter" for splitting camera video based on Vivek's vcam?
I am creating video processing application. The application is written using a mixture of WPF and C++/CLI (a DLL). I currently connect to a machine vision camera and use a few functions in the camera's native driver e.g. I grab image data, I set hardware region-of-interest (roi).
I am currently using windows 10. The application is currently converted to UWP with the Desktop bridge.
What I would like is to use some sort of Hardware-Abstraction-Layer to connect to a range of cameras and to access image data and ROI functions (if available).
I was wondering if someone experienced in this could take me through the options (if they exist) and what are the main considerations.
When I web-search I get lost in the search results (for example, is Windows Media Foundation a possibility, if not why not etc.). Much of the web results are pretty old.
So really I would like someone to give me a few pointers so I can feel sure I am on the right track.
It is impossible use DirectShow cameras from UWP - in MSDN Win32 and COM for Universal Windows Platform (UWP) apps (multimedia). You can use DirectShow cameras from direct calling as COM object, but it is workable only on Desktop Windows with full supporting of COM. Universal Windows Platform (UWP) is a platform for programming on Desktop and Mobile - these are Windows with different architecture and UWP is an abstract layer for simple deploying on different platforms - it leads to limit functionality.
I'm currently attempting to developing a small application / dll that will read a remote directshow filter graph and glean information from it for display in a "now playing" style plugin or script. After a few days of reading and subsequent testing, I realized that after getting the filter graph address from the ROT I was failing to convert it from the IUnknown interface pointer to IFilterGraph until I had registered "proppage.dll" which came with Windows SDK.
So what I am asking is, is there no other way to glean any information from a remote filter graph without having to register proppage.dll?
You can't call a COM interface from another address space unless you marshall the interface pointers and parameters/return values to and from the other process. For COM, you need to register a marshalling object for each interface that you want to be able to use cross-process. The standard implementation for that is in proppage.dll.
I don't think there is a simple way to access the interface without providing marshalling. If you don't want to use proppage.dll, you can build marshalling code from the IDL files supplied with the SDK and compile that into your own app.
G