Is it possible to fake a video stream as virtual cam that is visible in Skype, Lync etc?

umutto picture umutto · Aug 31, 2011 · Viewed 10.5k times · Source

I'm trying to build a crucial part for my application in which I need to be able to fake a virtual cam video stream. The video stream that I want to fake as a virtual webcam is streamed through my PC, where I can set the video source from my webcam or somewhere from my hdd. To sum up, something I can set as MediaElement.SourceProperty or Image.Source in WPF.

I've seen Vivek's Vcam, a directshow filter here in tmhare.com which seems like it is extremely related to what I'm looking for. But I couldn't find a way to compile it with VS2010, I also don't really know what to do with it. I think I need to change the input pin but how?

Anyhow, to sum up, I'm trying to build a partial code that needs to work like a small version of ManyCam. I'm building a WPF application where I stream the source from a 64 bit PC.

I would also appreciate some sample code for the filter since I have nearly forgotten everything I ever knew about C++ since DirectShow filter needs to be written in C++...

Thanks for everything!


Edit:

enter image description here

errors i got;

1   IntelliSense: identifier "REFERENCE_TIME" is undefined  c:\program files (x86)\microsoft sdks\windows\v7.0a\include\dvdmedia.h  307 5 // and 6 more
6   IntelliSense: not a class or struct name    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  8   22  Filters
7   IntelliSense: identifier "CUnknown" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  14  12  Filters
8   IntelliSense: identifier "IFilterGraph" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  17  5   Filters
9   IntelliSense: not a class or struct name    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  23  28  Filters
10  IntelliSense: not a class or struct name    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  23  50  Filters
11  IntelliSense: not a class or struct name    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  23  74  Filters
12  IntelliSense: identifier "IBaseFilter" is undefined c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  37  25  Filters
13  IntelliSense: identifier "Quality" is undefined c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  37  48  Filters
14  IntelliSense: identifier "AM_MEDIA_TYPE" is undefined   c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  42  41  Filters // and 7 more
17  IntelliSense: identifier "IMediaSample" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  60  24  Filters
18  IntelliSense: identifier "IMemAllocator" is undefined   c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  61  30  Filters
19  IntelliSense: identifier "ALLOCATOR_PROPERTIES" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  61  57  Filters
20  IntelliSense: identifier "CMediaType" is undefined  c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  62  34  Filters
21  IntelliSense: identifier "CMediaType" is undefined  c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  63  41  Filters
22  IntelliSense: identifier "CMediaType" is undefined  c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  64  32  Filters 69  5   Filters
24  IntelliSense: identifier "CCritSec" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  71  5   Filters
25  IntelliSense: identifier "IReferenceClock" is undefined c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.h  72  5   Filters
26  IntelliSense: cannot open source file "streams.h"   c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    4   1   Filters
27  IntelliSense: identifier "CUnknown" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    13  1   Filters
28  IntelliSense: identifier "ASSERT" is undefined  c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    15  5   Filters
29  IntelliSense: identifier "CUnknown" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    16  5   Filters
30  IntelliSense: identifier "punk" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    16  15  Filters
31  IntelliSense: "CSource" is not a nonstatic data member or base class of class "CVCam"   c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    21  5   Filters
32  IntelliSense: identifier "NAME" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    21  13  Filters
33  IntelliSense: expected a ')'    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    21  32  Filters
34  IntelliSense: identifier "ASSERT" is undefined  c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    23  5   Filters
35  IntelliSense: identifier "CAutoLock" is undefined   c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    24  5   Filters
36  IntelliSense: identifier "m_cStateLock" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    24  26  Filters
37  IntelliSense: identifier "m_paStreams" is undefined c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    26  5   Filters
38  IntelliSense: identifier "CSourceStream" is undefined   c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    26  20  Filters
39  IntelliSense: expected an expression    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    26  36  Filters
40  IntelliSense: expected a ';'    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    26  38  Filters
41  IntelliSense: identifier "IAMStreamConfig" is undefined c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    33  24  Filters
42  IntelliSense: identifier "IKsPropertySet" is undefined  c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    33  60  Filters
43  IntelliSense: identifier "m_paStreams" is undefined c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    34  16  Filters
44  IntelliSense: name followed by '::' must be a class or namespace name   c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    36  16  Filters
45  IntelliSense: identifier "IMediaSample" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    74  33  Filters
46  IntelliSense: identifier "IBaseFilter" is undefined c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    99  34  Filters
47  IntelliSense: identifier "Quality" is undefined c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    99  57  Filters
48  IntelliSense: identifier "CMediaType" is undefined  c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    107 41  Filters // and 3 more
51  IntelliSense: identifier "IMemAllocator" is undefined   c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    166 39  Filters
52  IntelliSense: identifier "ALLOCATOR_PROPERTIES" is undefined    c:\users\umutto\desktop\projects\src\directshowwizardinstaller\vcam\vcam\filters\filters.cpp    166 62  Filters

Answer

Horonchik picture Horonchik · Mar 14, 2012

In order to work with directshow filters, you need to have the Windows SDK installed and comiple the BaseClasses solution. look at: C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\multimedia\directshow\baseclasses

Afterward you need to add the BaseClasses header files and libs directories to your project properties.

Now your project will know the DirectShow classes and you can start changing the VCam source filter pin.