tshino / softcam Goto Github PK
View Code? Open in Web Editor NEWA library to make a virtual webcam on Windows
License: MIT License
A library to make a virtual webcam on Windows
License: MIT License
Are there any plans to include this library in a package manager like conan?
Hi, I have tried this project and it was so simple to setup! This is an amazing project, I am currently making an application that will be used by a few of my colleagues, one of them has a Mac, I was wondering whether there will ever be a plugin version of this, also could you give me an example on making it use an image for the camera as I am going to use OpenCV with it.
HI tsihon!
Great library, I have a project in unreal in which I integrated this library. The 64bit version works flawlessly, I can stream to Discord (from browser) or to Google Meet. But I've realized that the standalone version of discord is still 32bit, so I've tried to add support for as that well.
But it just doesn't work and I'm not sure why. I can see the virtual camera option in the discord camera combobox and I checked the registry for the COM object and the path is correct.
There might be some kind of race condition with the initialization, because sometimes 1 out of 10 it starts working if I attach my VS to both of my running instances and debug it step by step. (Unreal and Discord)
Do you have any idea what could go wrong? Because I have no issues with the 64bit version. And I could even manage to run the 32bit version, but only if I debug it in VS.
Any plans to support audio? If not, any hints on where I should get started to try to implement it myself?
Thanks to issue #2 and the nice reporter, now it is clear that to build 32-bit softcam.dll is required to support 32-bit camera applications.
dist
directory layout.Hi, I cloned main repo and latest release and tried to build them with VS2022 17.8.4.
I used Release x64 build type but I got these errors.
Desktop development environment with C++
.NET desktop development
Universal Windows Platform development
packages installed and I am using them with Unreal Engine without problem.
v1.7 Release Error
4> Creating library E:\Github\C++\WebCam\softcam\x64\Release\softcam.lib and object E:\Github\C++\WebCam\softcam\x64\Release\softcam.exp
4>softcam.vcxproj -> E:\Github\C++\WebCam\softcam\x64\Release\softcam.dll
3>core_tests.vcxproj -> E:\Github\C++\WebCam\softcam\x64\Release\core_tests.exe
4>Creating dist directory and copying the header and binaries into it.
4>softcam.h -> ...dist\include\softcam\
4>The system cannot find the file specified.
4>softcam.lib -> ...dist\lib\x64\
4>The system cannot find the file specified.
4>softcam.dll -> ...dist\bin\x64\
4>The system cannot find the file specified.
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: The command "@if not exist E:\Github\C++\WebCam\softcam\dist mkdir E:\Github\C++\WebCam\softcam\dist
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @if not exist E:\Github\C++\WebCam\softcam\dist\include mkdir E:\Github\C++\WebCam\softcam\dist\include
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @if not exist E:\Github\C++\WebCam\softcam\dist\include\softcam mkdir E:\Github\C++\WebCam\softcam\dist\include\softcam
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @if not exist E:\Github\C++\WebCam\softcam\dist\lib mkdir E:\Github\C++\WebCam\softcam\dist\lib
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @if not exist E:\Github\C++\WebCam\softcam\dist\lib\x64 mkdir E:\Github\C++\WebCam\softcam\dist\lib\x64
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @if not exist E:\Github\C++\WebCam\softcam\dist\bin mkdir E:\Github\C++\WebCam\softcam\dist\bin
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @if not exist E:\Github\C++\WebCam\softcam\dist\bin\x64 mkdir E:\Github\C++\WebCam\softcam\dist\bin\x64
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @echo softcam.h -^> ...dist\include\softcam\
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @copy /y E:\Github\C++\WebCam\softcam\src\softcam\softcam.h E:\Github\C++\WebCam\softcam\dist\include\softcam
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @echo softcam.lib -^> ...dist\lib\x64\
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @copy /y E:\Github\C++\WebCam\softcam\x64\Release\softcam.lib E:\Github\C++\WebCam\softcam\dist\lib\x64
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @echo softcam.dll -^> ...dist\bin\x64\
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @copy /y E:\Github\C++\WebCam\softcam\x64\Release\softcam.dll E:\Github\C++\WebCam\softcam\dist\bin\x64
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073:
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :VCEnd" exited with code 1.
4>Done building project "softcam.vcxproj" -- FAILED.
5>------ Build started: Project: dll_tests, Configuration: Release x64 ------
5>raw_api_test.cpp
5>dll_tests.vcxproj -> E:\Github\C++\WebCam\softcam\x64\Release\dll_tests.exe
========== Build: 4 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Main Errors:
4>The system cannot find the file specified.
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: The command "@if not exist E:\Github\C++\WebCam\softcam\dist mkdir E:\Github\C++\WebCam\softcam\dist
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @if not exist E:\Github\C++\WebCam\softcam\dist\include mkdir E:\Github\C++\WebCam\softcam\dist\include
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @if not exist E:\Github\C++\WebCam\softcam\dist\include\softcam mkdir E:\Github\C++\WebCam\softcam\dist\include\softcam
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @if not exist E:\Github\C++\WebCam\softcam\dist\lib mkdir E:\Github\C++\WebCam\softcam\dist\lib
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @if not exist E:\Github\C++\WebCam\softcam\dist\lib\x64 mkdir E:\Github\C++\WebCam\softcam\dist\lib\x64
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @if not exist E:\Github\C++\WebCam\softcam\dist\bin mkdir E:\Github\C++\WebCam\softcam\dist\bin
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @if not exist E:\Github\C++\WebCam\softcam\dist\bin\x64 mkdir E:\Github\C++\WebCam\softcam\dist\bin\x64
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @echo softcam.h -^> ...dist\include\softcam\
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @copy /y E:\Github\C++\WebCam\softcam\src\softcam\softcam.h E:\Github\C++\WebCam\softcam\dist\include\softcam
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @echo softcam.lib -^> ...dist\lib\x64\
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @copy /y E:\Github\C++\WebCam\softcam\x64\Release\softcam.lib E:\Github\C++\WebCam\softcam\dist\lib\x64
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @echo softcam.dll -^> ...dist\bin\x64\
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: @copy /y E:\Github\C++\WebCam\softcam\x64\Release\softcam.dll E:\Github\C++\WebCam\softcam\dist\bin\x64
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073:
4>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :VCEnd" exited with code 1.
4>Done building project "softcam.vcxproj" -- FAILED.
5>------ Build started: Project: dll_tests, Configuration: Release x64 ------
5>raw_api_test.cpp
5>dll_tests.vcxproj -> E:\Github\C++\WebCam\softcam\x64\Release\dll_tests.exe
========== Build: 4 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Is it possible to set resolution for the output?
I'd like to set aspect ratio manually, doesn't matter if I have to keep updating the registry until I get the one that suits me.
I'm having trouble getting my camera settings to run in Bluestacks as it is, so I'm going to try your dll solution wondering if their app is going to take the dll in.
Also, is this code capable of changing the Win10 native dll settings?
Thanks in advance and sorry if my questions are stupid.
I got this to work locally via my chrome browser, but Zoom doesn't recognize my virtual camera. Any idea on how to fix?
Hi, I tried loading an image in Python and sending it.
It works, but the image appears very blue.
Here is my code:
from PIL import Image
from x64.Release import softcam
def main():
dt = 1/60
cam = softcam.camera(1920, 1280, 60)
image = Image.open('./test.jpg')
image = image.convert('RGB')
# Here, you can wait for an application to connect to this camera.
while not cam.wait_for_connection(timeout=1):
pass
while True:
# send the image
cam.send_frame(image)
if __name__ == '__main__':
main()
What shows up in Zoom (virtual camera):
https://i.imgur.com/3ljVlsU.jpg
Any idea why? Is it related to the color table of the image? I tried converting to RGB, not sure what else I should do.
Thanks
Softcam doesn't appear in camera list on discord windows app on windows 10. OBS virtual cam appears in Camera list. Softcam virtual does appear in other apps (web browser, OBS, Zoom)
Hello. I understand that currently you can only use BGR24 format. It would be great if you could expand to ABGR32 (or a different layout) and or any YUV format. Other than that, it's a great wrapper.
Edit: Is it possible to choose between Progressive and Interlaced?
Hello,
I tried creating a python binding for softcam but I can't seem to make it work.
Those are the things i looked into:
Write C++ extensions for Python - Visual Studio
Speeding up Python with C++ and Pybind11
Has anyone tried that or has any ideas what I could do?
Thanks in advance and best regards!
Kev
I keep getting an error saying softcam.dll isn't found as I want to change the name of the dll.
I have installed the dll under a different name. It's just when I run the sender exe, it is looking for the wrong name.
Where is the piece of code to tell it to look for a different name, for example cam.dll
Thanks in advance.
Hi tshino,
Thanks for your great work!
If softcam supports multiple virtual cameras with different parameters, it would be very flexible for the users.
Please consider my suggestion.
Thank you!
could it add a convert function() which make input is a Mat format ?
a convert function() which make input is a Mat format as :
void Mat2DWimage( Mat matImage, vector &directShowImage )
{
int width = matImage.cols;
int height = matImage.rows;
int channels = matImage.channels();
std::vector directShowImage(width * height * 3);
if (matImage.isContinuous()) {
memcpy(directShowImage.data(), matImage.data, directShowImage.size());
} else {
// If the image is not stored continuously in memory, copy row by row
for (int row = 0; row < height; ++row) {
memcpy(&directShowImage[row * width * 3], matImage.ptr(row), width * 3);
}
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.