py-termcam 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. py_termcam-0.2.0/LICENSE +21 -0
  2. py_termcam-0.2.0/PKG-INFO +172 -0
  3. py_termcam-0.2.0/README.md +151 -0
  4. py_termcam-0.2.0/pyproject.toml +33 -0
  5. py_termcam-0.2.0/setup.cfg +4 -0
  6. py_termcam-0.2.0/src/py_termcam.egg-info/PKG-INFO +172 -0
  7. py_termcam-0.2.0/src/py_termcam.egg-info/SOURCES.txt +38 -0
  8. py_termcam-0.2.0/src/py_termcam.egg-info/dependency_links.txt +1 -0
  9. py_termcam-0.2.0/src/py_termcam.egg-info/entry_points.txt +2 -0
  10. py_termcam-0.2.0/src/py_termcam.egg-info/requires.txt +8 -0
  11. py_termcam-0.2.0/src/py_termcam.egg-info/top_level.txt +1 -0
  12. py_termcam-0.2.0/src/termcam/__init__.py +0 -0
  13. py_termcam-0.2.0/src/termcam/__main__.py +6 -0
  14. py_termcam-0.2.0/src/termcam/camera.py +58 -0
  15. py_termcam-0.2.0/src/termcam/cli.py +102 -0
  16. py_termcam-0.2.0/src/termcam/colors.py +59 -0
  17. py_termcam-0.2.0/src/termcam/engine.py +207 -0
  18. py_termcam-0.2.0/src/termcam/font.py +105 -0
  19. py_termcam-0.2.0/src/termcam/frame.py +33 -0
  20. py_termcam-0.2.0/src/termcam/keys.py +69 -0
  21. py_termcam-0.2.0/src/termcam/renderer.py +31 -0
  22. py_termcam-0.2.0/src/termcam/sources.py +35 -0
  23. py_termcam-0.2.0/src/termcam/styles/__init__.py +23 -0
  24. py_termcam-0.2.0/src/termcam/styles/ascii.py +33 -0
  25. py_termcam-0.2.0/src/termcam/styles/base.py +23 -0
  26. py_termcam-0.2.0/src/termcam/styles/dither.py +47 -0
  27. py_termcam-0.2.0/src/termcam/styles/glitch.py +32 -0
  28. py_termcam-0.2.0/src/termcam/styles/halftone.py +35 -0
  29. py_termcam-0.2.0/src/termcam/styles/negative.py +49 -0
  30. py_termcam-0.2.0/src/termcam/styles/neon.py +40 -0
  31. py_termcam-0.2.0/src/termcam/styles/sketch.py +52 -0
  32. py_termcam-0.2.0/src/termcam/styles/thermal.py +46 -0
  33. py_termcam-0.2.0/src/termcam/webcam.py +157 -0
  34. py_termcam-0.2.0/tests/test_cli.py +80 -0
  35. py_termcam-0.2.0/tests/test_colors.py +38 -0
  36. py_termcam-0.2.0/tests/test_frame.py +26 -0
  37. py_termcam-0.2.0/tests/test_renderer.py +20 -0
  38. py_termcam-0.2.0/tests/test_sources.py +20 -0
  39. py_termcam-0.2.0/tests/test_styles.py +131 -0
  40. py_termcam-0.2.0/tests/test_webcam.py +55 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 termcam contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,172 @@
1
+ Metadata-Version: 2.4
2
+ Name: py-termcam
3
+ Version: 0.2.0
4
+ Summary: Live webcam → terminal art in 8 styles, with a virtual camera for OBS. Works without a camera too.
5
+ Author: termcam contributors
6
+ License: MIT
7
+ Keywords: webcam,terminal,ascii-art,creative-coding,cli,virtual-camera,obs
8
+ Classifier: Environment :: Console
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Topic :: Multimedia :: Video :: Capture
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: opencv-python>=4.8
15
+ Provides-Extra: dev
16
+ Requires-Dist: pytest>=8.0; extra == "dev"
17
+ Provides-Extra: webcam
18
+ Requires-Dist: pyvirtualcam>=0.12; extra == "webcam"
19
+ Requires-Dist: numpy>=1.24; extra == "webcam"
20
+ Dynamic: license-file
21
+
22
+ # termcam
23
+
24
+ Your webcam — live — rendered in the terminal as ASCII, neon, dither or
25
+ glitch art. One keystroke changes the style. No GUI windows, no browser, just
26
+ the console and you.
27
+
28
+ No webcam? **termcam** generates a procedural plasma that still reacts to
29
+ your keystrokes and serves as a screensaver-style demo.
30
+
31
+ ## Install
32
+
33
+ ```bash
34
+ pip install termcam # terminal + window art
35
+ pip install "termcam[webcam]" # + virtual camera (--out webcam)
36
+ ```
37
+
38
+ ## Quick start
39
+
40
+ ```bash
41
+ termcam # uses webcam, ascii style, 24 fps
42
+ termcam --source synth # no webcam needed — procedural plasma
43
+ termcam --source url --url "http://192.168.1.5:8080/video" # phone via IP Webcam
44
+ termcam --out webcam --source synth # art becomes a virtual camera device
45
+ termcam --out window --source synth # art in a GUI window (OBS Window Capture)
46
+ ```
47
+
48
+ ### Hotkeys (while running)
49
+
50
+ | Key | Action |
51
+ |-----|---------------------------|
52
+ | a | ASCII (luminance → chars) |
53
+ | s | Neon (color gradient) |
54
+ | d | Dither (pixel noise) |
55
+ | g | Glitch (sparkling) |
56
+ | e | Sketch (edge detection) |
57
+ | h | Halftone (newsprint) |
58
+ | t | Thermal (heatmap) |
59
+ | x | Negative (film invert) |
60
+ | m | Mirror / un-mirror |
61
+ | q | Quit |
62
+
63
+ Press the style key repeatedly for palette variants.
64
+
65
+ ## Styles
66
+
67
+ - **ASCII** — classic monochrome luminance ramp (`" .:-=+*#%@"`)
68
+ - **Neon** — full color, mapped through an ANSI 256 palette
69
+ - **Dither** — 4×4 Bayer matrix noise, retro pixel look
70
+ - **Glitch** — per-frame hash sparkle, chaotic but alive
71
+ - **Sketch** — edge detection (Sobel-like), pencil-look line art, light/dark paper
72
+ - **Halftone** — newspaper print: ink shades on paper-color background
73
+ - **Thermal** — heatmap palettes (fire, inferno, deep water, lava-pink)
74
+ - **Negative** — film negative, posterized, cyan/magenta/warm X-ray tints
75
+
76
+ Every style has palette/param variants — keep pressing its key to cycle.
77
+
78
+ ## CLI options
79
+
80
+ ```
81
+ termcam
82
+ --source {camera,synth,url} input source (default: camera)
83
+ --style {ascii,neon,dith,glitch,sketch,halftone,thermal,negative} (default: ascii)
84
+ --out {terminal,webcam,window,both} (default: terminal)
85
+ --fps N frames per second (default: 24)
86
+ --cols N terminal width hint (auto-detected)
87
+ --device N camera device index (default: 0)
88
+ --url URL MJPEG stream for --source url
89
+ --backend {auto,obs,unitycapture} virtual camera backend (default: auto)
90
+ --webcam-size WxH virtual camera resolution (default: 1280x720)
91
+ --mirror flip horizontally
92
+ ```
93
+
94
+ ## Virtual camera & OBS
95
+
96
+ You can turn the art itself into a webcam device.
97
+
98
+ **As a real webcam in ANY app including OBS** (best: no OBS dependency):
99
+
100
+ ```bash
101
+ pip install "termcam[webcam]"
102
+ termcam --source synth --out webcam --backend unitycapture
103
+ ```
104
+
105
+ This uses the free, open-source [UnityCapture](https://github.com/schellingb/UnityCapture)
106
+ DirectShow filter as the virtual camera device **`Unity Video Capture`**. Install it
107
+ once as administrator:
108
+
109
+ 1. Clone/download [UnityCapture](https://github.com/schellingb/UnityCapture).
110
+ 2. From `UnityCapture/Install` run `Install.bat` as administrator (registers two
111
+ DLLs via `regsvr32`). Keep that folder in place while installed.
112
+ 3. In OBS: **Sources → + → Video Capture Device → Unity Video Capture**.
113
+ The device appears even while termcam runs without OBS active.
114
+
115
+ Remove it later with `Uninstall.bat` (as administrator).
116
+
117
+ **As a webcam in other apps** (Zoom, Discord, …), using OBS's own virtual camera:
118
+
119
+ ```bash
120
+ termcam --out webcam --source synth
121
+ ```
122
+
123
+ With the `obs` backend, start **OBS Studio → Start Virtual Camera** once, then pick
124
+ `OBS Virtual Camera` as the camera in any other app. Cannot be consumed as an
125
+ input inside the same OBS instance.
126
+
127
+ **Preview window** (for OBS Window Capture if you prefer):
128
+
129
+ ```bash
130
+ termcam --out window --source synth
131
+ ```
132
+
133
+ A window titled `termcam` opens; in OBS add **Sources → Window Capture →
134
+ termcam**.
135
+
136
+ Hotkeys work in every output mode (`a/s/d/g/e/h/t/x`, `m`, `q`).
137
+
138
+ ## Phone as a webcam
139
+
140
+ No USB webcam? Any Android phone with a WiFi connection works — termcam just
141
+ needs a URL. Tested target: a 2016 Samsung Galaxy J1 Mini (Android 5.1).
142
+
143
+ 1. Install the free app **IP Webcam** on the phone (Play Store; works on
144
+ Android 5.0+).
145
+ 2. Connect the phone and your PC to the **same WiFi** network.
146
+ 3. Open IP Webcam → tap **Start server** at the bottom. The app shows an
147
+ address like `http://192.168.1.5:8080`.
148
+ 4. Verify on the PC in a browser: open that address — you should see the
149
+ camera preview. (Phone as a hotspot also works: connect the PC to the
150
+ phone's hotspot instead.)
151
+ 5. Point termcam at the MJPEG stream:
152
+
153
+ ```bash
154
+ termcam --source url --url "http://192.168.1.5:8080/video"
155
+ ```
156
+
157
+ 6. Hotkeys are the same — `a/s/d/g` switches styles, so the low-res J1 Mini
158
+ camera becomes lo-fi neon/dither art.
159
+
160
+ If IP Webcam has a password set (Settings → Login), embed it in the URL:
161
+ `http://user:pass@192.168.1.5:8080/video`.
162
+
163
+ ## Development
164
+
165
+ ```bash
166
+ pip install -e ".[dev]"
167
+ pytest
168
+ ```
169
+
170
+ ## License
171
+
172
+ MIT
@@ -0,0 +1,151 @@
1
+ # termcam
2
+
3
+ Your webcam — live — rendered in the terminal as ASCII, neon, dither or
4
+ glitch art. One keystroke changes the style. No GUI windows, no browser, just
5
+ the console and you.
6
+
7
+ No webcam? **termcam** generates a procedural plasma that still reacts to
8
+ your keystrokes and serves as a screensaver-style demo.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ pip install termcam # terminal + window art
14
+ pip install "termcam[webcam]" # + virtual camera (--out webcam)
15
+ ```
16
+
17
+ ## Quick start
18
+
19
+ ```bash
20
+ termcam # uses webcam, ascii style, 24 fps
21
+ termcam --source synth # no webcam needed — procedural plasma
22
+ termcam --source url --url "http://192.168.1.5:8080/video" # phone via IP Webcam
23
+ termcam --out webcam --source synth # art becomes a virtual camera device
24
+ termcam --out window --source synth # art in a GUI window (OBS Window Capture)
25
+ ```
26
+
27
+ ### Hotkeys (while running)
28
+
29
+ | Key | Action |
30
+ |-----|---------------------------|
31
+ | a | ASCII (luminance → chars) |
32
+ | s | Neon (color gradient) |
33
+ | d | Dither (pixel noise) |
34
+ | g | Glitch (sparkling) |
35
+ | e | Sketch (edge detection) |
36
+ | h | Halftone (newsprint) |
37
+ | t | Thermal (heatmap) |
38
+ | x | Negative (film invert) |
39
+ | m | Mirror / un-mirror |
40
+ | q | Quit |
41
+
42
+ Press the style key repeatedly for palette variants.
43
+
44
+ ## Styles
45
+
46
+ - **ASCII** — classic monochrome luminance ramp (`" .:-=+*#%@"`)
47
+ - **Neon** — full color, mapped through an ANSI 256 palette
48
+ - **Dither** — 4×4 Bayer matrix noise, retro pixel look
49
+ - **Glitch** — per-frame hash sparkle, chaotic but alive
50
+ - **Sketch** — edge detection (Sobel-like), pencil-look line art, light/dark paper
51
+ - **Halftone** — newspaper print: ink shades on paper-color background
52
+ - **Thermal** — heatmap palettes (fire, inferno, deep water, lava-pink)
53
+ - **Negative** — film negative, posterized, cyan/magenta/warm X-ray tints
54
+
55
+ Every style has palette/param variants — keep pressing its key to cycle.
56
+
57
+ ## CLI options
58
+
59
+ ```
60
+ termcam
61
+ --source {camera,synth,url} input source (default: camera)
62
+ --style {ascii,neon,dith,glitch,sketch,halftone,thermal,negative} (default: ascii)
63
+ --out {terminal,webcam,window,both} (default: terminal)
64
+ --fps N frames per second (default: 24)
65
+ --cols N terminal width hint (auto-detected)
66
+ --device N camera device index (default: 0)
67
+ --url URL MJPEG stream for --source url
68
+ --backend {auto,obs,unitycapture} virtual camera backend (default: auto)
69
+ --webcam-size WxH virtual camera resolution (default: 1280x720)
70
+ --mirror flip horizontally
71
+ ```
72
+
73
+ ## Virtual camera & OBS
74
+
75
+ You can turn the art itself into a webcam device.
76
+
77
+ **As a real webcam in ANY app including OBS** (best: no OBS dependency):
78
+
79
+ ```bash
80
+ pip install "termcam[webcam]"
81
+ termcam --source synth --out webcam --backend unitycapture
82
+ ```
83
+
84
+ This uses the free, open-source [UnityCapture](https://github.com/schellingb/UnityCapture)
85
+ DirectShow filter as the virtual camera device **`Unity Video Capture`**. Install it
86
+ once as administrator:
87
+
88
+ 1. Clone/download [UnityCapture](https://github.com/schellingb/UnityCapture).
89
+ 2. From `UnityCapture/Install` run `Install.bat` as administrator (registers two
90
+ DLLs via `regsvr32`). Keep that folder in place while installed.
91
+ 3. In OBS: **Sources → + → Video Capture Device → Unity Video Capture**.
92
+ The device appears even while termcam runs without OBS active.
93
+
94
+ Remove it later with `Uninstall.bat` (as administrator).
95
+
96
+ **As a webcam in other apps** (Zoom, Discord, …), using OBS's own virtual camera:
97
+
98
+ ```bash
99
+ termcam --out webcam --source synth
100
+ ```
101
+
102
+ With the `obs` backend, start **OBS Studio → Start Virtual Camera** once, then pick
103
+ `OBS Virtual Camera` as the camera in any other app. Cannot be consumed as an
104
+ input inside the same OBS instance.
105
+
106
+ **Preview window** (for OBS Window Capture if you prefer):
107
+
108
+ ```bash
109
+ termcam --out window --source synth
110
+ ```
111
+
112
+ A window titled `termcam` opens; in OBS add **Sources → Window Capture →
113
+ termcam**.
114
+
115
+ Hotkeys work in every output mode (`a/s/d/g/e/h/t/x`, `m`, `q`).
116
+
117
+ ## Phone as a webcam
118
+
119
+ No USB webcam? Any Android phone with a WiFi connection works — termcam just
120
+ needs a URL. Tested target: a 2016 Samsung Galaxy J1 Mini (Android 5.1).
121
+
122
+ 1. Install the free app **IP Webcam** on the phone (Play Store; works on
123
+ Android 5.0+).
124
+ 2. Connect the phone and your PC to the **same WiFi** network.
125
+ 3. Open IP Webcam → tap **Start server** at the bottom. The app shows an
126
+ address like `http://192.168.1.5:8080`.
127
+ 4. Verify on the PC in a browser: open that address — you should see the
128
+ camera preview. (Phone as a hotspot also works: connect the PC to the
129
+ phone's hotspot instead.)
130
+ 5. Point termcam at the MJPEG stream:
131
+
132
+ ```bash
133
+ termcam --source url --url "http://192.168.1.5:8080/video"
134
+ ```
135
+
136
+ 6. Hotkeys are the same — `a/s/d/g` switches styles, so the low-res J1 Mini
137
+ camera becomes lo-fi neon/dither art.
138
+
139
+ If IP Webcam has a password set (Settings → Login), embed it in the URL:
140
+ `http://user:pass@192.168.1.5:8080/video`.
141
+
142
+ ## Development
143
+
144
+ ```bash
145
+ pip install -e ".[dev]"
146
+ pytest
147
+ ```
148
+
149
+ ## License
150
+
151
+ MIT
@@ -0,0 +1,33 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "py-termcam"
7
+ version = "0.2.0"
8
+ description = "Live webcam → terminal art in 8 styles, with a virtual camera for OBS. Works without a camera too."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "MIT" }
12
+ authors = [{ name = "termcam contributors" }]
13
+ keywords = ["webcam", "terminal", "ascii-art", "creative-coding", "cli", "virtual-camera", "obs"]
14
+ classifiers = [
15
+ "Environment :: Console",
16
+ "Programming Language :: Python :: 3",
17
+ "Topic :: Multimedia :: Video :: Capture",
18
+ ]
19
+ dependencies = ["opencv-python>=4.8"]
20
+
21
+ [project.scripts]
22
+ termcam = "termcam.cli:main"
23
+
24
+ [project.optional-dependencies]
25
+ dev = ["pytest>=8.0"]
26
+ webcam = ["pyvirtualcam>=0.12", "numpy>=1.24"]
27
+
28
+ [tool.setuptools.packages.find]
29
+ where = ["src"]
30
+
31
+ [tool.pytest.ini_options]
32
+ testpaths = ["tests"]
33
+ pythonpath = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,172 @@
1
+ Metadata-Version: 2.4
2
+ Name: py-termcam
3
+ Version: 0.2.0
4
+ Summary: Live webcam → terminal art in 8 styles, with a virtual camera for OBS. Works without a camera too.
5
+ Author: termcam contributors
6
+ License: MIT
7
+ Keywords: webcam,terminal,ascii-art,creative-coding,cli,virtual-camera,obs
8
+ Classifier: Environment :: Console
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Topic :: Multimedia :: Video :: Capture
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: opencv-python>=4.8
15
+ Provides-Extra: dev
16
+ Requires-Dist: pytest>=8.0; extra == "dev"
17
+ Provides-Extra: webcam
18
+ Requires-Dist: pyvirtualcam>=0.12; extra == "webcam"
19
+ Requires-Dist: numpy>=1.24; extra == "webcam"
20
+ Dynamic: license-file
21
+
22
+ # termcam
23
+
24
+ Your webcam — live — rendered in the terminal as ASCII, neon, dither or
25
+ glitch art. One keystroke changes the style. No GUI windows, no browser, just
26
+ the console and you.
27
+
28
+ No webcam? **termcam** generates a procedural plasma that still reacts to
29
+ your keystrokes and serves as a screensaver-style demo.
30
+
31
+ ## Install
32
+
33
+ ```bash
34
+ pip install termcam # terminal + window art
35
+ pip install "termcam[webcam]" # + virtual camera (--out webcam)
36
+ ```
37
+
38
+ ## Quick start
39
+
40
+ ```bash
41
+ termcam # uses webcam, ascii style, 24 fps
42
+ termcam --source synth # no webcam needed — procedural plasma
43
+ termcam --source url --url "http://192.168.1.5:8080/video" # phone via IP Webcam
44
+ termcam --out webcam --source synth # art becomes a virtual camera device
45
+ termcam --out window --source synth # art in a GUI window (OBS Window Capture)
46
+ ```
47
+
48
+ ### Hotkeys (while running)
49
+
50
+ | Key | Action |
51
+ |-----|---------------------------|
52
+ | a | ASCII (luminance → chars) |
53
+ | s | Neon (color gradient) |
54
+ | d | Dither (pixel noise) |
55
+ | g | Glitch (sparkling) |
56
+ | e | Sketch (edge detection) |
57
+ | h | Halftone (newsprint) |
58
+ | t | Thermal (heatmap) |
59
+ | x | Negative (film invert) |
60
+ | m | Mirror / un-mirror |
61
+ | q | Quit |
62
+
63
+ Press the style key repeatedly for palette variants.
64
+
65
+ ## Styles
66
+
67
+ - **ASCII** — classic monochrome luminance ramp (`" .:-=+*#%@"`)
68
+ - **Neon** — full color, mapped through an ANSI 256 palette
69
+ - **Dither** — 4×4 Bayer matrix noise, retro pixel look
70
+ - **Glitch** — per-frame hash sparkle, chaotic but alive
71
+ - **Sketch** — edge detection (Sobel-like), pencil-look line art, light/dark paper
72
+ - **Halftone** — newspaper print: ink shades on paper-color background
73
+ - **Thermal** — heatmap palettes (fire, inferno, deep water, lava-pink)
74
+ - **Negative** — film negative, posterized, cyan/magenta/warm X-ray tints
75
+
76
+ Every style has palette/param variants — keep pressing its key to cycle.
77
+
78
+ ## CLI options
79
+
80
+ ```
81
+ termcam
82
+ --source {camera,synth,url} input source (default: camera)
83
+ --style {ascii,neon,dith,glitch,sketch,halftone,thermal,negative} (default: ascii)
84
+ --out {terminal,webcam,window,both} (default: terminal)
85
+ --fps N frames per second (default: 24)
86
+ --cols N terminal width hint (auto-detected)
87
+ --device N camera device index (default: 0)
88
+ --url URL MJPEG stream for --source url
89
+ --backend {auto,obs,unitycapture} virtual camera backend (default: auto)
90
+ --webcam-size WxH virtual camera resolution (default: 1280x720)
91
+ --mirror flip horizontally
92
+ ```
93
+
94
+ ## Virtual camera & OBS
95
+
96
+ You can turn the art itself into a webcam device.
97
+
98
+ **As a real webcam in ANY app including OBS** (best: no OBS dependency):
99
+
100
+ ```bash
101
+ pip install "termcam[webcam]"
102
+ termcam --source synth --out webcam --backend unitycapture
103
+ ```
104
+
105
+ This uses the free, open-source [UnityCapture](https://github.com/schellingb/UnityCapture)
106
+ DirectShow filter as the virtual camera device **`Unity Video Capture`**. Install it
107
+ once as administrator:
108
+
109
+ 1. Clone/download [UnityCapture](https://github.com/schellingb/UnityCapture).
110
+ 2. From `UnityCapture/Install` run `Install.bat` as administrator (registers two
111
+ DLLs via `regsvr32`). Keep that folder in place while installed.
112
+ 3. In OBS: **Sources → + → Video Capture Device → Unity Video Capture**.
113
+ The device appears even while termcam runs without OBS active.
114
+
115
+ Remove it later with `Uninstall.bat` (as administrator).
116
+
117
+ **As a webcam in other apps** (Zoom, Discord, …), using OBS's own virtual camera:
118
+
119
+ ```bash
120
+ termcam --out webcam --source synth
121
+ ```
122
+
123
+ With the `obs` backend, start **OBS Studio → Start Virtual Camera** once, then pick
124
+ `OBS Virtual Camera` as the camera in any other app. Cannot be consumed as an
125
+ input inside the same OBS instance.
126
+
127
+ **Preview window** (for OBS Window Capture if you prefer):
128
+
129
+ ```bash
130
+ termcam --out window --source synth
131
+ ```
132
+
133
+ A window titled `termcam` opens; in OBS add **Sources → Window Capture →
134
+ termcam**.
135
+
136
+ Hotkeys work in every output mode (`a/s/d/g/e/h/t/x`, `m`, `q`).
137
+
138
+ ## Phone as a webcam
139
+
140
+ No USB webcam? Any Android phone with a WiFi connection works — termcam just
141
+ needs a URL. Tested target: a 2016 Samsung Galaxy J1 Mini (Android 5.1).
142
+
143
+ 1. Install the free app **IP Webcam** on the phone (Play Store; works on
144
+ Android 5.0+).
145
+ 2. Connect the phone and your PC to the **same WiFi** network.
146
+ 3. Open IP Webcam → tap **Start server** at the bottom. The app shows an
147
+ address like `http://192.168.1.5:8080`.
148
+ 4. Verify on the PC in a browser: open that address — you should see the
149
+ camera preview. (Phone as a hotspot also works: connect the PC to the
150
+ phone's hotspot instead.)
151
+ 5. Point termcam at the MJPEG stream:
152
+
153
+ ```bash
154
+ termcam --source url --url "http://192.168.1.5:8080/video"
155
+ ```
156
+
157
+ 6. Hotkeys are the same — `a/s/d/g` switches styles, so the low-res J1 Mini
158
+ camera becomes lo-fi neon/dither art.
159
+
160
+ If IP Webcam has a password set (Settings → Login), embed it in the URL:
161
+ `http://user:pass@192.168.1.5:8080/video`.
162
+
163
+ ## Development
164
+
165
+ ```bash
166
+ pip install -e ".[dev]"
167
+ pytest
168
+ ```
169
+
170
+ ## License
171
+
172
+ MIT
@@ -0,0 +1,38 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/py_termcam.egg-info/PKG-INFO
5
+ src/py_termcam.egg-info/SOURCES.txt
6
+ src/py_termcam.egg-info/dependency_links.txt
7
+ src/py_termcam.egg-info/entry_points.txt
8
+ src/py_termcam.egg-info/requires.txt
9
+ src/py_termcam.egg-info/top_level.txt
10
+ src/termcam/__init__.py
11
+ src/termcam/__main__.py
12
+ src/termcam/camera.py
13
+ src/termcam/cli.py
14
+ src/termcam/colors.py
15
+ src/termcam/engine.py
16
+ src/termcam/font.py
17
+ src/termcam/frame.py
18
+ src/termcam/keys.py
19
+ src/termcam/renderer.py
20
+ src/termcam/sources.py
21
+ src/termcam/webcam.py
22
+ src/termcam/styles/__init__.py
23
+ src/termcam/styles/ascii.py
24
+ src/termcam/styles/base.py
25
+ src/termcam/styles/dither.py
26
+ src/termcam/styles/glitch.py
27
+ src/termcam/styles/halftone.py
28
+ src/termcam/styles/negative.py
29
+ src/termcam/styles/neon.py
30
+ src/termcam/styles/sketch.py
31
+ src/termcam/styles/thermal.py
32
+ tests/test_cli.py
33
+ tests/test_colors.py
34
+ tests/test_frame.py
35
+ tests/test_renderer.py
36
+ tests/test_sources.py
37
+ tests/test_styles.py
38
+ tests/test_webcam.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ termcam = termcam.cli:main
@@ -0,0 +1,8 @@
1
+ opencv-python>=4.8
2
+
3
+ [dev]
4
+ pytest>=8.0
5
+
6
+ [webcam]
7
+ pyvirtualcam>=0.12
8
+ numpy>=1.24
@@ -0,0 +1 @@
1
+ termcam
File without changes
@@ -0,0 +1,6 @@
1
+ import sys
2
+
3
+ from .cli import main
4
+
5
+ if __name__ == "__main__":
6
+ main(sys.argv[1:])
@@ -0,0 +1,58 @@
1
+ from __future__ import annotations
2
+
3
+ import cv2
4
+
5
+ from .frame import Frame
6
+
7
+
8
+ def _read_and_resize(cap, cols: int, rows: int) -> Frame:
9
+ ok, frame = cap.read()
10
+ if not ok:
11
+ raise RuntimeError("Source returned no frame")
12
+ resized = cv2.resize(
13
+ frame,
14
+ (cols, rows * 2),
15
+ interpolation=cv2.INTER_AREA,
16
+ )
17
+ pixels = [
18
+ [(int(p[2]), int(p[1]), int(p[0])) for p in row] for row in resized
19
+ ]
20
+ return Frame(cols, rows * 2, pixels)
21
+
22
+
23
+ class CameraSource:
24
+ def __init__(self, device: int = 0, cols: int = 80, rows: int = 40) -> None:
25
+ self.device = device
26
+ self.cols = cols
27
+ self.rows = rows
28
+ self._cap = cv2.VideoCapture(device)
29
+ if not self._cap.isOpened():
30
+ raise RuntimeError(f"Could not open camera device {device}")
31
+
32
+ def read(self) -> Frame:
33
+ try:
34
+ return _read_and_resize(self._cap, self.cols, self.rows)
35
+ except RuntimeError:
36
+ raise RuntimeError("Camera returned no frame") from None
37
+
38
+ def close(self) -> None:
39
+ self._cap.release()
40
+
41
+
42
+ class UrlSource:
43
+ def __init__(self, url: str, cols: int = 80, rows: int = 40) -> None:
44
+ self.url = url
45
+ self.cols = cols
46
+ self.rows = rows
47
+ self._cap = cv2.VideoCapture(url)
48
+ if not self._cap.isOpened():
49
+ raise RuntimeError(f"Could not open stream at {url}")
50
+
51
+ def read(self) -> Frame:
52
+ try:
53
+ return _read_and_resize(self._cap, self.cols, self.rows)
54
+ except RuntimeError:
55
+ raise RuntimeError(f"Stream returned no frame: {self.url}") from None
56
+
57
+ def close(self) -> None:
58
+ self._cap.release()