# cowtoolz/webcamize architecture

> Architecture diagram of the GitHub repository cowtoolz/webcamize, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cowtoolz/webcamize
- Repository: https://github.com/cowtoolz/webcamize

## Overview

##### Project type and purpose
- Webcamize is an open-source CLI tool (a tiny Bash script) whose sole purpose is to let you use virtually any camera as a webcam on Linux.
- It wraps around three core external pieces of software: gphoto2 (to talk to the camera), ffmpeg (to package the video stream), and the v4l2loopback kernel module (to create virtual /dev/video devices).
- There is also an optional systemd service unit for automatic startup.

##### File structure
- Top-level files:
- webcamize   – the main Bash script orchestrator
- webcamize.service – systemd unit file
- readme.md, assets/… – documentation, usage examples, and supported devices list
- No “frontend/backend” split—this is purely a CLI orchestration tool.
- No compiled code or heavy internal libraries; all the “heavy lifting” is done by gphoto2, ffmpeg, and v4l2loopback.

##### README for additional insights
- Clearly describes a two-step flow: “plug in camera” → “run webcamize.”
- Documents command-line flags, multi-camera setups, and systemd integration.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core components
    User["User (CLI)"]:::user
    Systemd["systemd service (optional)"]:::optional
    Script["webcamize (Bash)"]:::script
    Modprobe["modprobe"]:::kernel
    V4L2["v4l2loopback (kernel module)"]:::kernel
    Gphoto2["gphoto2"]:::external
    Ffmpeg["ffmpeg"]:::external
    Dev["/dev/video0-N"]:::kernel
    Apps["Video Apps (Zoom, OBS, VLC)"]:::consumer

    %% Documentation components
    subgraph Documentation
        README["readme.md"]:::doc
        Supported["assets/supported.md"]:::doc
        Contrib["contributing.md"]:::doc
        License["license"]:::doc
    end

    %% Relationships
    Systemd -->|"auto-start"| Script
    User -->|"invoke"| Script
    Script -->|"ensure loaded"| Modprobe
    Modprobe --> V4L2
    Script --> Gphoto2
    Gphoto2 --> Ffmpeg
    Ffmpeg -->|"writes to"| Dev
    V4L2 --> Dev
    Dev --> Apps

    %% Click events
    click Script "https://github.com/cowtoolz/webcamize/tree/master/webcamize"
    click Systemd "https://github.com/cowtoolz/webcamize/blob/master/webcamize.service"
    click README "https://github.com/cowtoolz/webcamize/blob/master/readme.md"
    click Supported "https://github.com/cowtoolz/webcamize/blob/master/assets/supported.md"
    click Contrib "https://github.com/cowtoolz/webcamize/blob/master/contributing.md"
    click License "https://github.com/cowtoolz/webcamize/tree/master/license"

    %% Styles
    classDef user fill:#cce5ff,stroke:#004085
    classDef script fill:#ccefff,stroke:#0066cc
    classDef external fill:#d4edda,stroke:#155724,shape:hexagon
    classDef kernel fill:#fff3cd,stroke:#856404
    classDef consumer fill:#ffe5b4,stroke:#cc8400,shape:rounded
    classDef optional fill:#e2e3e5,stroke:#6c757d,stroke-dasharray:5 5
    classDef doc fill:#f0f0f0,stroke:#333,stroke-dasharray:2 2
```
