winlivecam
A Python library to create a virtual camera on Windows and stream the content of a selected window (by PID or title) to it.
Features
- Windows 11 Native Support: Uses the new
MFCreateVirtualCameraAPI for seamless integration on Windows 11. - Windows 10 Compatibility: Falls back to a high-performance DirectShow filter.
- Stream any visible Windows application window to a virtual camera.
- Select windows by Process ID (PID) or window title.
- Leverages C++ for high-performance window capture and virtual camera implementation.
- Easy-to-use Python API.
Installation
Prerequisites
- Windows 10 or 11 (Windows 11 recommended for native Virtual Camera API support)
- Python 3.7+
- Visual Studio Build Tools (for C++ compilation, if building from source)
Install via pip (Coming Soon)
pip install winlivecam
Manual Installation (from source)
- Clone the repository:
</code></pre> </li> </ol> <p>git clone <a href="https://github.com/G3tFun/winlivecam.git">https://github.com/G3tFun/winlivecam.git</a> cd winlivecam ```</p> <ol start="2"> <li><strong>Build the C++ extension and virtual camera driver:</strong> <pre><code class="language-bash">
pip install pybind11 cmake pip install . ```
- Register the virtual camera driver:
After installation, you need to register the DirectShow filter DLL. This usually requires administrator privileges.
</code></pre> </li> </ol> <p>from winlivecam import LiveCam LiveCam.install() <code>To unregister:</code>python from winlivecam import LiveCam LiveCam.uninstall() ```</p> <h2><a href="#user-content-usage" aria-hidden="true" class="anchor" id="user-content-usage"></a>Usage</h2> <p>Here's a simple example of how to use <code>winlivecam</code> to stream a window by its PID:</p> <pre><code class="language-python">from winlivecam import LiveCam import time # Replace with the actual PID of the window you want to stream # You can find the PID using Task Manager or other tools. TARGET_PID = 12345 cam = LiveCam() try: print(f"Starting virtual camera stream for PID: {TARGET_PID}") cam.start_by_pid(TARGET_PID) print("Streaming... Press Ctrl+C to stop.") while True: time.sleep(1) # Keep the script running except KeyboardInterrupt: print("Stopping stream.") cam.stop() print("Stream stopped.")
Building from Source (Development)
If you want to contribute or modify the C++ code, follow these steps:
- Install CMake and Visual Studio Build Tools.
- Clone the repository.
- Build using CMake:
mkdir build cd build cmake .. cmake --build . ``` This will build
winlivecam_core.pyd(Python extension) and `vcam-filter.dll` (DirectShow filter).Contributing
Contributions are welcome! Please feel free to open issues or submit pull requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgements
- Inspired by
mycrl/vcamand OBS Virtual Camera implementations. - Uses
pybind11for Python-C++ interoperability.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
winlivecam-0.1.1.tar.gz
(4.2 kB
view details)
File details
Details for the file winlivecam-0.1.1.tar.gz.
File metadata
- Download URL: winlivecam-0.1.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.11.0rc1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1da6813a30055a5cd915307b093be53d4c24c0bdd066bfbc74185bb95644bb47
|
|
| MD5 |
262656c6dbef0e1f39599ee5345c6219
|
|
| BLAKE2b-256 |
19de43efa93543d5f10f0e71341a036a13185189f5c69f993bf0c9596bc950e3
|