Metadata-Version: 2.4
Name: winlivecam
Version: 0.1.1
Summary: A Python library to stream any Windows window to a virtual camera.
Author: G3tFun
License-Expression: MIT
Project-URL: Homepage, https://github.com/G3tFun/winlivecam
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: Microsoft :: Windows
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# 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 `MFCreateVirtualCamera` API 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)

```bash
pip install winlivecam
```

### Manual Installation (from source)

1.  **Clone the repository:**
    ```bash
git clone https://github.com/G3tFun/winlivecam.git
cd winlivecam
    ```

2.  **Build the C++ extension and virtual camera driver:**
    ```bash
pip install pybind11 cmake
pip install .
    ```

3.  **Register the virtual camera driver:**
    After installation, you need to register the DirectShow filter DLL. This usually requires administrator privileges.
    ```python
from winlivecam import LiveCam
LiveCam.install()
    ```
    To unregister:
    ```python
from winlivecam import LiveCam
LiveCam.uninstall()
    ```

## Usage

Here's a simple example of how to use `winlivecam` to stream a window by its PID:

```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:

1.  **Install CMake and Visual Studio Build Tools.**
2.  **Clone the repository.**
3.  **Build using CMake:**
    ```bash
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](LICENSE) file for details.

## Acknowledgements

*   Inspired by `mycrl/vcam` and OBS Virtual Camera implementations.
*   Uses `pybind11` for Python-C++ interoperability.

