(h)ascii for the masses! html refreshed ascii video cam
(h)ascii for the masses! html refreshed ascii video cam
88 88 db .dP"Y8 dP""b8 88 88 dP""b8 db 8b d8
88 88 dPYb `Ybo." dP `" 88 88 dP `" dPYb 88b d88
888888 dP__Yb o.`Y8b Yb 88 88 Yb dP__Yb 88YbdP88
88 88 dP""""Yb 8bodP' YboodP 88 88 YboodP dP""""Yb 88 YY 88
[ (h)ascii for the masses! ]
Hasciicam makes it possible to have live ascii video on the web. It captures video from a tv card and renders it into ascii, formatting the output into an html page with a refresh tag or in a live ascii window or in a simple text file as well, giving the possiblity to anybody that has a bttv card. a linux box and a cheap modem line to show a live asciivideo feed that can be browsable without any need for plugin, java etc. (which was an issue, back in 2001 when it was done).
PNG and JPEG still images can also be used as a repeatable source with
--image FILE; they work in live, text, and HTML modes.
Prerequisites:
Standard build (uses whichever generator CMake picks by default — Unix Makefiles on Linux/macOS, Visual Studio on Windows):
cmake -B build .
cmake --build build -j
cmake --install build # optional; installs to CMAKE_INSTALL_PREFIXThe build produces build/hasciicam (the CLI) and build/libhasciicam_core.a
(the reusable core linked by host samples under examples/).
Run the tests:
ctest --output-on-failure --test-dir buildWith presets (recommended for cross-platform maintenance, requires Ninja):
cmake --list-presets
cmake --preset macos-ninja # or linux-ninja, windows-vcpkg-ninja, wasm-emscripten
cmake --build --preset macos-ninjaThe available presets are linux-ninja, macos-ninja, windows-vcpkg-ninja,
and wasm-emscripten. Install Ninja first (brew install ninja,
apt install ninja-build, or choco install ninja).
The Emscripten preset builds a live browser camera sample under examples/wasm.
It always selects rendering automatically: SDL/WebGL, then SDL software, then a
native Canvas 2D path that bypasses SDL canvas initialization. The demo uses the
AA-lib vga9 font throughout. It must be served from localhost or HTTPS rather
than opened with file://. See
examples/wasm/README.md for the exact /opt/emsdk
and build-local EM_CACHE commands, the opt-in Chromium CTest smoke, and the
separate real-camera checklist.
Common CMake options (all -D=ON|OFF):
HASCIICAM_BUILD_CLI — build the hasciicam executable (default ON).HASCIICAM_ENABLE_TESTS — build CTest targets (default ON).HASCIICAM_ENABLE_SDL, HASCIICAM_ENABLE_X11, HASCIICAM_ENABLE_CURSES —
display backends; each is auto-disabled if its dependency is not found.HASCIICAM_ENABLE_CAPTURE_V4L2 / _MF / _DSHOW / _AVFOUNDATION —
capture backends per platform.HASCIICAM_ENABLE_GUI — SDL live-mode ImGui overlay (default ON).HASCIICAM_ENABLE_VIRTUAL_CAMERA — build the virtual webcam output.Versioning:
project(hasciicam VERSION ...) in
CMakeLists.txt — bump it once per release (matching the git tag vX.Y.Z).git describe --tags --match "v*" --always --dirty, so tag builds report
the exact version and branch builds report X.Y.Z--g[-dirty]..git) fall back to the project(VERSION ...) literal.cmake -B build . after fetching new tags to refresh the banner.Quick smoke test after building:
./build/hasciicam -h # CLI help
./build/hasciicam -H # CLI + AA-lib help
./build/hasciicam -d synthetic:// --frames 2 -O stdout # no-camera pipeline test
./build/hasciicam -O SDL # live ASCII from the default cameraOn macOS, live mode triggers a Camera permission prompt on first run; grant it
in System Settings → Privacy & Security → Camera for the terminal that
launched hasciicam.
HasciiCam can show an optional on-screen control panel in live SDL mode.
HASCIICAM_ENABLE_GUI (requires SDL and vendored Dear ImGui under third_party/imgui/)Save text frame writes the next rendered live grid to hasciicam.txt by default. It is a one-shot snapshot and stores characters only, not colors or AA attributes.Save writes TOML, Load reads TOMLFile chooser behavior:
GetOpenFileNameW dialogAt startup, HasciiCam checks for hasciicam.toml in the current working
directory and loads it when present. Use --config path/to/file.toml to load a
specific TOML file instead.
Configuration precedence is:
hasciicam.toml or --config)Font selection:
--font list prints all bundled AA bitmap fonts (short names)--font selects one startup AA font (for example vga16, vga8, courier)font = "vga16" in TOML/env sets the same AA bitmap font--font-face remains HTML CSS font face (different from AA bitmap font)The executable pipeline is split into explicit capture and conversion stages:
src/capture/capture_backend.c.capture_ops contract in src/capture/capture.h.src/capture/frame_convert.c.SDL, stdout, save drivers).This keeps platform camera code out of the render path and lets new backends plug in without changing AA-lib behavior.
On Windows, video capture backends are tried in this order:
Live output preference remains SDL first when available.
The -d option on Windows is treated as a camera matcher (friendly-name substring),
not as a /dev/video* path.
Use -d "" to select the first available camera.
Quick live smoke test:
.\build-sdl-rel\hasciicam.exe -q -d "" -O SDLWhen a matcher does not resolve, startup logs show backend fallback attempts.
For local MSVC builds in this repo, a Release configuration is recommended:
cmake -S . -B build-msvc-rel -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build build-msvc-relHasciiCam can publish the live SDL ASCII frame stream as a virtual webcam. The published image is the ASCII render itself, not the cursor, ImGui overlay, or window chrome.
hasciicam -O SDL --virtual-camera, and use Windows 11 build 22000 or later.v4l2loopback device, then run hasciicam -O SDL --virtual-camera --virtual-camera-device /dev/video10.1280x720 at 30 fps.1280x720 at 30 fps.Hasciicam is designed, written and maintained by Jaromil
People who contributed to this project:
Special thanks to:
This source code is free software; you can redistribute it and/or modify it under the terms of the GNU Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This source code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Please refer to the GNU Public License for more details.
You should have received a copy of the GNU Public License along with this source code; if not, write to: Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
No open issues yet, or sync has not completed.